code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
/** * Global Styles for older IE versions (previous to IE9). */ pre, fieldset, table, th, td, input, textarea { border: 1px solid #e5e5e5; } hr { background-color: #e5e5e5; } button, input, select, textarea { vertical-align: middle; } input:focus, textarea:focus { border: 1px solid #b2b2b2; } .site-content blockquote.alignleft, .site-content blockquote.alignright { border-top: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5; } .post-thumbnail, a.post-thumbnail:hover { background: transparent; } .list-view .site-content .hentry { border-top: 1px solid #e5e5e5; padding-top: 48px; } .gallery-caption { background: #000; filter: alpha(opacity=0); } .gallery-item:hover .gallery-caption { filter: alpha(opacity=70); } .nav-links { border-top: 1px solid #e5e5e5; } .post-navigation a, .image-navigation .previous-image, .image-navigation .next-image, .contributor { border-bottom: 1px solid #e5e5e5; } .contributor-avatar, .comment-author .avatar { border: 1px solid #e5e5e5; } .comment-list article, .comment-list .pingback, .comment-list .trackback { border-top: 1px solid #e5e5e5; } .comment-list .reply { margin-top: 0; } #secondary { color: #b3b3b3; } .widget abbr[title] { border-color: #b3b3b3; } .widget pre, .widget fieldset, .widget table, .widget th, .widget td, .widget input, .widget textarea { border-color: #4d4d4d; } .widget blockquote, .widget .wp-caption, .widget_twentyfourteen_ephemera .entry-meta a { color: #b3b3b3; } .widget del { color: #666; } .widget hr { background-color: #4d4d4d; } .widget input, .widget textarea { background-color: #1a1a1a; } .widget input:focus, .widget textarea:focus { border-color: #262626; } .widget_calendar thead th { background-color: #1a1a1a; } .widget_twentyfourteen_ephemera > ol > li { border-bottom: 1px solid #4d4d4d; } .widget_archive li, .widget_categories li, .widget_links li, .widget_meta li, .widget_nav_menu li, .widget_pages li, .widget_recent_comments li, .widget_recent_entries li, .widget_categories li ul, .widget_nav_menu li ul, .widget_pages li ul { border-top: 1px solid #4d4d4d; } .content-sidebar .widget pre, .content-sidebar .widget fieldset, .content-sidebar .widget table, .content-sidebar .widget th, .content-sidebar .widget td, .content-sidebar .widget input, .content-sidebar .widget textarea, .content-sidebar .widget_archive li, .content-sidebar .widget_categories li, .content-sidebar .widget_links li, .content-sidebar .widget_meta li, .content-sidebar .widget_nav_menu li, .content-sidebar .widget_pages li, .content-sidebar .widget_recent_comments li, .content-sidebar .widget_recent_entries li, .content-sidebar .widget_categories li ul, .content-sidebar .widget_nav_menu li ul, .content-sidebar .widget_pages li ul { border-color: #e5e5e5; } .content-sidebar .widget hr { background-color: #e5e5e5; } .content-sidebar .widget input:focus, .content-sidebar .widget textarea:focus { border: 1px solid #b2b2b2; } .content-sidebar .widget_calendar thead th { background-color: #fafafa; } .content-sidebar .widget_twentyfourteen_ephemera > ol > li { border-bottom: 1px solid #e5e5e5; } .site-footer, .site-info, .site-info a { color: #b3b3b3; } #supplementary + .site-info { border-top: 1px solid #4d4d4d; } .featured-content { background: #000; } /** * Internet Explorer 8 */ .ie8 img.size-full, .ie8 img.size-large, .ie8 img.header-image, .ie8 img.wp-post-image, .ie8 img[class*="align"], .ie8 img[class*="wp-image-"], .ie8 img[class*="attachment-"] { height: auto; width: auto; /* Prevent stretching of full-size and large-size images with height and width attributes in IE8 */ } .ie8 .full-size-link:before, .ie8 .parent-post-link:before, .ie8 .site-content span + .byline:before, .ie8 .site-content span + .comments-link:before, .ie8 .site-content span + .edit-link:before, .ie8 .site-content span + .entry-date:before { content: ""; } .ie8 .attachment span.entry-date:before, .ie8 .entry-content .edit-link a:before, .ie8 .entry-meta .edit-link a:before, .ie8 .site-content .byline a:before, .ie8 .site-content .comments-link a:before, .ie8 .site-content .entry-date a:before, .ie8 .site-content .featured-post:before, .ie8 .site-content .full-size-link a:before, .ie8 .site-content .parent-post-link a:before, .ie8 .site-content .post-format a:before { display: inline-block; font: normal 16px/1 Genericons; text-decoration: inherit; vertical-align: text-bottom; } .ie8 .site-content .entry-meta > span { margin-right: 10px; } .ie8 .site-content .format-video .post-format a:before { content: "\f104"; } .ie8 .site-content .format-audio .post-format a:before { content: "\f109"; } .ie8 .site-content .format-image .post-format a:before { content: "\f473"; position: relative; top: 1px; } .ie8 .site-content .format-quote .post-format a:before { content: "\f106"; margin-right: 2px; } .ie8 .site-content .format-gallery .post-format a:before { content: "\f103"; margin-right: 4px; } .ie8 .site-content .format-aside .post-format a:before { content: "\f101"; margin-right: 2px; } .ie8 .site-content .format-link .post-format a:before { content: "\f107"; position: relative; top: 1px; } .ie8 .site-content .featured-post:before { content: "\f308"; margin-right: 3px; position: relative; top: 1px; } .ie8 .site-content .entry-date a:before, .ie8 .attachment .site-content span.entry-date:before { content: "\f303"; margin-right: 1px; position: relative; top: 1px; } .ie8 .site-content .byline a:before { content: "\f304"; } .ie8 .site-content .comments-link a:before { content: "\f300"; margin-right: 2px; } .ie8 .entry-content .edit-link a:before, .ie8 .entry-meta .edit-link a:before { content: "\f411"; } .ie8 .site-content .full-size-link a:before { content: "\f402"; margin-right: 1px; } .ie8 .site-content .parent-post-link a:before { content: "\f301"; } .ie8 .main-content { float: left; } .ie8 .content-area { float: left; padding-top: 72px; width: 100%; } .ie8 .site-content { margin-right: 29.04761904%; margin-left: 17.61904761%; } .ie8 .search-box-wrapper, .ie8 .featured-content { padding-left: 17.61904761%; } .ie8 .header-main { padding: 0 0 0 30px; } .ie8 .search-toggle { margin-right: 0; } .ie8 .search-box .search-field { width: 324px; } .ie8 .site-navigation li .current_page_item > a, .ie8 .site-navigation li .current_page_ancestor > a, .ie8 .site-navigation li .current-menu-item > a, .ie8 .site-navigation li .current-menu-ancestor > a { background-color: #000; } .ie8 .primary-navigation { float: right; font-size: 11px; margin: 0 1px 0 -10px; padding: 0; text-transform: uppercase; } .ie8 .primary-navigation .menu-toggle { display: none; padding: 0; } .ie8 .primary-navigation .nav-menu { border-bottom: 0; display: block; } .ie8 .primary-navigation.toggled-on { border-bottom: 0; margin: 0; padding: 0; } .ie8 .primary-navigation li { border: 0; display: inline-block; height: 48px; line-height: 48px; position: relative; } .ie8 .primary-navigation a { display: inline-block; padding: 0 10px; white-space: nowrap; } .ie8 .primary-navigation ul ul { background-color: #24890d; float: left; margin: 0; position: absolute; top: 48px; left: -999em; z-index: 99999; } .ie8 .primary-navigation li li { border: 0; display: block; height: auto; line-height: 1.0909090909; } .ie8 .primary-navigation ul ul ul { left: -999em; top: 0; } .ie8 .primary-navigation ul ul a { padding: 18px 12px; white-space: normal; width: 176px; } .ie8 .primary-navigation li:hover > a, .ie8 .primary-navigation li.focus > a { background-color: #24890d; color: #fff; } .ie8 .primary-navigation ul ul a:hover, .ie8 .primary-navigation ul ul li.focus > a { background-color: #41a62a; } .ie8 .primary-navigation ul li:hover > ul, .ie8 .primary-navigation ul li.focus > ul { left: auto; } .ie8 .primary-navigation ul ul li:hover > ul, .ie8 .primary-navigation ul ul li.focus > ul { left: 100%; } .ie8 .archive-header, .ie8 .page-header { margin: 0 auto 60px; padding: 0 10px; } .ie8 .site-content .has-post-thumbnail .entry-header { margin-top: -48px; } .ie8 .archive-header, .ie8 .comments-area, .ie8 .image-navigation, .ie8 .page-header, .ie8 .page-content, .ie8 .post-navigation, .ie8 .site-content .entry-header, .ie8 .site-content .entry-content, .ie8 .site-content .entry-summary, .ie8 .site-content footer.entry-meta { margin-right: 54px; padding-right: 30px; padding-left: 30px; } .ie8 .list-view .site-content .hentry:first-child, .ie8 .list-view .site-content .hentry.has-post-thumbnail { border-top: 0; padding-top: 0; } .ie8 .comment-list .trackback, .ie8 .comment-list .pingback, .ie8 .comment-list article { margin-bottom: 36px; padding-top: 36px; } .ie8 .comment-author .avatar { height: 34px; top: 2px; width: 34px; } .ie8 .comment-author, .ie8 .comment-awaiting-moderation, .ie8 .comment-content, .ie8 .comment-list .reply, .ie8 .comment-metadata { padding-left: 50px; } .ie8 .comment-list .children { margin-left: 20px; } .ie8 .full-width .site-content { margin-right: 0; } .ie8 .full-width .archive-header, .ie8 .full-width .comments-area, .ie8 .full-width .image-navigation, .ie8 .full-width .page-header, .ie8 .full-width .page-content, .ie8 .full-width .post-navigation, .ie8 .full-width .site-content .entry-header, .ie8 .full-width .site-content .entry-content, .ie8 .full-width .site-content .entry-summary, .ie8 .full-width .site-content footer.entry-meta { padding-right: 30px; padding-left: 30px; margin-right: auto; } .ie8 .full-width.singular .hentry.has-post-thumbnail, .ie8 .full-width.home .hentry.has-post-thumbnail { margin-top: -72px; } .ie8 .singular .hentry.has-post-thumbnail { margin-top: 0; } .ie8 .error404 .page-header { margin-bottom: 24px; } .ie8 .contributor-avatar { margin-left: -168px; } .ie8 .contributor-summary { float: left; } .ie8 .site:before { background-color: #000; content: ""; display: block; height: 100%; min-height: 100%; position: absolute; top: 0; left: 0; width: 17.61904761%; z-index: 2; } .ie8 #secondary { border: 0; clear: none; color: #b3b3b3; float: left; margin: 0 0 0 -100%; min-height: 100vh; padding: 0 30px; width: 12.85714285%; } .ie8 .site-description { display: block; margin: -3px 0 21px; } .ie8 .secondary-navigation { font-size: 11px; margin: 0 -30px 48px; width: calc(100% + 60px); } .ie8 .secondary-navigation li { border-top: 1px solid #4d4d4d; position: relative; } .ie8 .secondary-navigation a { padding: 10px 30px; } .ie8 .secondary-navigation ul ul { background-color: #24890d; position: absolute; top: 0; left: -999em; width: 222px; z-index: 99999; } .ie8 .secondary-navigation li li { border-top: 0; } .ie8 .secondary-navigation li:hover > a, .ie8 .secondary-navigation li.focus > a { background-color: #24890d; color: #fff; } .ie8 .secondary-navigation ul ul a:hover, .ie8 .secondary-navigation ul ul li.focus > a { background-color: #41a62a; } .ie8 .secondary-navigation ul li:hover > ul, .ie8 .secondary-navigation ul li.focus > ul { left: 202px; } .ie8 .content-sidebar { border: 0; float: right; margin-left: -29.04761904%; padding: 72px 30px 24px; width: 29.04761904%; } .ie8 #supplementary { padding: 0; } .ie8 .footer-sidebar { font-size: 12px; line-height: 1.5; } .ie8 .footer-sidebar .widget, .ie8 .primary-sidebar .widget { font-size: 12px; line-height: 1.5; } .ie8 .footer-sidebar .widget { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; float: left; padding: 0 30px; width: 25%; } .ie8 .footer-sidebar .widget h1, .ie8 .primary-sidebar .widget h1 { font-size: 20px; line-height: 1.2; } .ie8 .footer-sidebar .widget h2, .ie8 .primary-sidebar .widget h2 { font-size: 18px; line-height: 1.3333333333; } .ie8 .footer-sidebar .widget h3, .ie8 .primary-sidebar .widget h3 { font-size: 16px; line-height: 1.5; } .ie8 .footer-sidebar .widget h4, .ie8 .primary-sidebar .widget h4 { font-size: 14px; line-height: 1.7142857142; } .ie8 .footer-sidebar .widget h5, .ie8 .primary-sidebar .widget h5 { font-size: 12px; line-height: 2; } .ie8 .footer-sidebar .widget h6, .ie8 .primary-sidebar .widget h6 { font-size: 11px; line-height: 2.1818181818; } .ie8 .footer-sidebar .widget code, .ie8 .footer-sidebar .widget kbd, .ie8 .footer-sidebar .widget tt, .ie8 .footer-sidebar .widget var, .ie8 .footer-sidebar .widget samp, .ie8 .footer-sidebar .widget pre, .ie8 .primary-sidebar .widget code, .ie8 .primary-sidebar .widget kbd, .ie8 .primary-sidebar .widget tt, .ie8 .primary-sidebar .widget var, .ie8 .primary-sidebar .widget samp, .ie8 .primary-sidebar .widget pre { font-size: 11px; line-height: 1.6363636363; } .ie8 .footer-sidebar .widget blockquote, .ie8 .primary-sidebar .widget blockquote { font-size: 14px; line-height: 1.2857142857; } .ie8 .footer-sidebar .widget blockquote cite, .ie8 .primary-sidebar .widget blockquote cite { font-size: 12px; line-height: 1.5; } .ie8 .footer-sidebar .widget input, .ie8 .footer-sidebar .widget textarea, .ie8 .primary-sidebar .widget input, .ie8 .primary-sidebar .widget textarea { font-size: 12px; padding: 3px 2px 4px 4px; } .ie8 .footer-sidebar .widget input[type="button"], .ie8 .footer-sidebar .widget input[type="reset"], .ie8 .footer-sidebar .widget input[type="submit"], .ie8 .primary-sidebar .widget input[type="button"], .ie8 .primary-sidebar .widget input[type="reset"], .ie8 .primary-sidebar .widget input[type="submit"] { padding: 5px 15px 4px; } .ie8 .footer-sidebar .widget .widget-title, .ie8 .primary-sidebar .widget .widget-title { font-size: 11px; font-weight: 700; line-height: 1.6363636363; margin-bottom: 18px; } .ie8 .footer-sidebar .widget_twentyfourteen_ephemera .entry-title, .ie8 .footer-sidebar .widget_twentyfourteen_ephemera .entry-meta, .ie8 .footer-sidebar .widget_twentyfourteen_ephemera .wp-caption-text, .ie8 .footer-sidebar .widget_twentyfourteen_ephemera .post-format-archive-link, .ie8 .footer-sidebar .widget_twentyfourteen_ephemera .entry-content table, .ie8 .primary-sidebar .widget_twentyfourteen_ephemera .entry-title, .ie8 .primary-sidebar .widget_twentyfourteen_ephemera .entry-meta, .ie8 .primary-sidebar .widget_twentyfourteen_ephemera .wp-caption-text, .ie8 .primary-sidebar .widget_twentyfourteen_ephemera .post-format-archive-link, .ie8 .primary-sidebar .widget_twentyfourteen_ephemera .entry-content table { font-size: 11px; line-height: 1.6363636363; } .ie8 .footer-sidebar .widget_archive li, .ie8 .footer-sidebar .widget_categories li, .ie8 .footer-sidebar .widget_links li, .ie8 .footer-sidebar .widget_meta li, .ie8 .footer-sidebar .widget_nav_menu li, .ie8 .footer-sidebar .widget_pages li, .ie8 .footer-sidebar .widget_recent_comments li, .ie8 .footer-sidebar .widget_recent_entries li, .ie8 .primary-sidebar .widget_archive li, .ie8 .primary-sidebar .widget_categories li, .ie8 .primary-sidebar .widget_links li, .ie8 .primary-sidebar .widget_meta li, .ie8 .primary-sidebar .widget_nav_menu li, .ie8 .primary-sidebar .widget_pages li, .ie8 .primary-sidebar .widget_recent_comments li, .ie8 .primary-sidebar .widget_recent_entries li { border-top: 0; padding: 0 0 6px; } .ie8 .footer-sidebar .widget_categories li ul, .ie8 .footer-sidebar .widget_nav_menu li ul, .ie8 .footer-sidebar .widget_pages li ul, .ie8 .primary-sidebar .widget_categories li ul, .ie8 .primary-sidebar .widget_nav_menu li ul, .ie8 .primary-sidebar .widget_pages li ul { border-top: 0; margin-top: 0; } .ie8 .grid .featured-content .entry-header { border-color: #000; border-style: solid; border-width: 12px 10px; height: 96px; padding: 0; } .ie8 .featured-content { padding-left: 17.61904761%; } .ie8 .grid .featured-content .hentry { float: left; width: 33.3333333%; } .ie8 .grid .featured-content .hentry:nth-child( 3n+1 ) { clear: both; } .ie8 .grid .featured-content .entry-header { height: 120px; } .ie8 .slider .featured-content .entry-title { font-size: 33px; line-height: 1.0909090909; } .ie8 .slider .featured-content .entry-header { min-height: inherit; padding: 24px 30px 48px; position: absolute; left: 0; bottom: 0; width: 50%; z-index: 3; } .ie8 .slider-control-paging { background: transparent; margin-top: -48px; padding-left: 24px; width: 50%; } .ie8 .slider-control-paging li { margin: 12px 12px 12px 0; } .ie8 .slider-control-paging a { height: 24px; width: 24px; } .ie8 .slider-control-paging a:before { top: 6px; left: 6px; } .ie8 .slider-direction-nav { clear: none; float: right; margin-top: -48px; width: 98px; } .ie8 .slider-direction-nav li:first-child { padding: 0 1px 0 0; } .ie8 .slider-direction-nav li { border: 0; padding: 0 0 0 1px; } .ie8 .slider-direction-nav a { height: 48px; } .ie8 .slider-direction-nav a:before { line-height: 48px; } /** * Internet Explorer 7 */ .ie7 audio, .ie7 canvas, .ie7 video { display: inline; zoom: 1; } .ie7 button, .ie7 input, .ie7 select, .ie7 textarea { vertical-align: middle; } .ie7 button, .ie7 input[type="button"], .ie7 input[type="reset"], .ie7 input[type="submit"] { overflow: visible; } .ie7 .screen-reader-text { clip: rect(1px 1px 1px 1px); } .ie7 .site, .ie7 .site-header { max-width: 100%; } .ie7 .search-toggle { line-height: 45px; margin-right: 190px; padding: 0 20px; text-transform: uppercase; width: auto; } .ie7 .search-toggle .screen-reader-text { color: #fff; position: relative; /* Override inherited `absolute` value set in style.css. */ } .ie7 .search-box { height: 24px; padding: 12px 0; } .ie7 .search-box .search-field { margin: 0 10px; width: 33%; } .ie7 .site-navigation li { border-top: 1px solid #4d4d4d; } .ie7 .primary-navigation .nav-menu, .ie7 .secondary-navigation { border-bottom: 1px solid #4d4d4d; } .ie7 .secondary-navigation { margin: 48px auto; max-width: 474px } .ie7 .content-area { padding-top: 48px; } .ie7 .hentry { max-width: 100%; } .ie7 .menu-toggle { color: #fff; font-weight: 400; font-size: 16px; line-height: 45px; text-transform: uppercase; width: 200px; } .ie7 .post-thumbnail img { display: block; margin: 0 auto; } .ie7 .entry-meta .tag-links a { margin-left: 0; } .ie7 .content-sidebar { padding: 48px 10px; } .ie7 .singular .hentry.has-post-thumbnail { margin-top: -48px; } .ie7 .entry-meta > span, .ie7 .widget_twentyfourteen_ephemera .entry-title { margin-right: 20px; } .ie7 #secondary { border-bottom: 1px solid #4d4d4d; } .ie7 .content-sidebar { border-top: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5; } .ie7 .widget { margin: 0 auto 48px; max-width: 474px; } .ie7 .content-sidebar .widget_twentyfourteen_ephemera .widget-title { padding-top: 7px; } .ie7 .slider .featured-content .hentry { display: block; } .ie7 .featured-content .entry-header { min-height: 0; } .ie7 .slider-control-paging a { line-height: 40px; text-indent: 0; } .ie7 .slider-control-paging .slider-active { color: #41a62a; } .ie7 .slider-direction-nav { border-top: 2px solid #fff; } .ie7 .slider-direction-nav li { border: 0; width: 49%; } .ie7 .slider-direction-nav a { font-size: 16px; line-height: 45px; text-transform: uppercase; } .ie7 .slider-direction-nav a:hover { background-color: #000; color: #41a62a; } .ie7 .search-toggle { line-height: 45px; margin-right: 190px; } .ie7 .featured-content .post-thumbnail, .ie7 .slider .featured-content .post-thumbnail { padding-top: 0; } .ie7 .featured-content .post-thumbnail img { position: relative; } .ie7 .featured-content .entry-header { width: auto; } .ie7 .grid .featured-content .hentry { float: left; margin: 0 auto; max-width: 672px; width: 33.333333%; } .ie7 .slider .featured-content .entry-header { margin: 0 auto; max-width: 1038px; } .ie7 .slider-control-paging { float: none; margin: -24px auto 0; max-width: 1038px; width: auto; } /** * RTL for Internet Explorer 8 & 7 */ .rtl .attachment a, .rtl .gallery a, .rtl .wp-caption a, .rtl .widget_twentyfourteen_ephemera .entry-content a { display: inline; } /** * RTL overrides for Internet Explorer 8 */ .ie8 .rtl .site-content .entry-meta > span { margin-right: auto; margin-left: 10px; } .ie8 .rtl .site-content .format-quote .post-format a:before { margin-right: auto; margin-left: 2px; } .ie8 .rtl .site-content .format-gallery .post-format a:before { margin-right: auto; margin-left: 4px; } .ie8 .rtl .site-content .format-aside .post-format a:before { margin-right: auto; margin-left: 2px; } .ie8 .rtl .site-content .featured-post:before { margin-right: auto; margin-left: 3px; } .ie8 .rtl .site-content .entry-date a:before, .ie8 .rtl .attachment .site-content span.entry-date:before { margin-right: auto; margin-left: 1px; } .ie8 .rtl .site-content .comments-link a:before { margin-right: auto; margin-left: 2px; } .ie8 .rtl .site-content .full-size-link a:before { margin-right: auto; margin-left: 1px; } .ie8 .rtl .main-content { float: right; } .ie8 .rtl .content-area { float: right; } .ie8 .rtl .site-content { margin-right: 17.61904761%; margin-left: 29.04761904%; } .ie8 .rtl .search-box-wrapper, .ie8 .rtl .featured-content { padding-right: 17.61904761%; padding-left: 0; } .ie8 .rtl .header-main { padding: 0 30px 0 0; } .ie8 .rtl .search-toggle { margin-right: auto; margin-left: 0; } .ie8 .rtl .primary-navigation { float: left; margin: 0 -10px 0 1px; } .ie8 .rtl .primary-navigation ul ul { float: right; right: -999em; left: auto; } .ie8 .rtl .primary-navigation ul ul ul { right: -999em; left: auto; } .ie8 .rtl .primary-navigation ul li:hover > ul, .ie8 .rtl .primary-navigation ul li.focus > ul { right: auto; left: auto; } .ie8 .rtl .primary-navigation ul ul li:hover > ul, .ie8 .rtl .primary-navigation ul ul li.focus > ul { right: 100%; left: auto; } .ie8 .rtl .entry-meta .tag-links a:before { right: -8px; } .ie8 .rtl .archive-header, .ie8 .rtl .comments-area, .ie8 .rtl .image-navigation, .ie8 .rtl .page-header, .ie8 .rtl .page-content, .ie8 .rtl .post-navigation, .ie8 .rtl .site-content .entry-header, .ie8 .rtl .site-content .entry-content, .ie8 .rtl .site-content .entry-summary, .ie8 .rtl .site-content footer.entry-meta { margin-right: auto; margin-left: 54px; } .ie8 .rtl .comment-author, .ie8 .rtl .comment-awaiting-moderation, .ie8 .rtl .comment-content, .ie8 .rtl .comment-list .reply, .ie8 .rtl .comment-metadata { padding-right: 50px; padding-left: 0; } .ie8 .rtl .comment-list .children { margin-right: 20px; margin-left: auto; } .ie8 .rtl.full-width .site-content { margin-left: 0; } .ie8 .rtl.full-width .archive-header, .ie8 .rtl.full-width .comments-area, .ie8 .rtl.full-width .image-navigation, .ie8 .rtl.full-width .page-header, .ie8 .rtl.full-width .page-content, .ie8 .rtl.full-width .post-navigation, .ie8 .rtl.full-width .site-content .entry-header, .ie8 .rtl.full-width .site-content .entry-content, .ie8 .rtl.full-width .site-content .entry-summary, .ie8 .rtl.full-width .site-content footer.entry-meta { margin-left: auto; } .ie8 .rtl .contributor-avatar { margin-right: -168px; margin-left: auto; } .ie8 .rtl .contributor-summary { float: right; } .ie8 .rtl .site:before { right: 0; left: auto; } .ie8 .rtl #secondary { float: right; margin: 0 -100% 0 0; } .ie8 .rtl .secondary-navigation ul ul { right: -999em; left: auto; } .ie8 .rtl .secondary-navigation ul li:hover > ul, .ie8 .rtl .secondary-navigation ul li.focus > ul { right: 202px; left: auto; } .ie8 .rtl .content-sidebar { float: left; margin-right: -29.04761904%; margin-left: auto; } .ie8 .rtl .footer-sidebar .widget { float: right; } .ie8 .rtl .featured-content { padding-right: 17.61904761%; padding-left: 0; } .ie8 .rtl.grid .featured-content .hentry { float: right; } .ie8 .rtl.slider .featured-content .entry-header { right: 0; left: auto; } .ie8 .rtl .slider-control-paging { padding-right: 24px; padding-left: 0; } .ie8 .rtl .slider-control-paging li { margin: 12px 0 12px 12px; } .ie8 .rtl .slider-control-paging a:before { right: 6px; left: auto; } .ie8 .rtl .slider-direction-nav { float: left; } .ie8 .rtl .slider-direction-nav li { padding: 0 1px 0 0; } .ie8 .rtl .slider-direction-nav li:first-child { padding: 0 0 0 1px; } /** * RTL overrides for Internet Explorer 7 */ .ie7 .rtl.grid .featured-content .hentry { float: right; } .ie7 .rtl .slider-control-paging { float: none; margin: -24px auto 0; } .ie7 .rtl .entry-meta .tag-links a { margin-right: 0; margin-left: auto; } .ie7 .rtl .search-toggle { margin-right: auto; margin-left: 190px; }
01-wordpress-paypal
trunk/wp-content/themes/twentyfourteen/css/ie.css
CSS
gpl3
24,682
<?php /** * The template for displaying featured content * * @package WordPress * @subpackage Twenty_Fourteen * @since Twenty Fourteen 1.0 */ ?> <div id="featured-content" class="featured-content"> <div class="featured-content-inner"> <?php /** * Fires before the Twenty Fourteen featured content. * * @since Twenty Fourteen 1.0 */ do_action( 'twentyfourteen_featured_posts_before' ); $featured_posts = twentyfourteen_get_featured_posts(); foreach ( (array) $featured_posts as $order => $post ) : setup_postdata( $post ); // Include the featured content template. get_template_part( 'content', 'featured-post' ); endforeach; /** * Fires after the Twenty Fourteen featured content. * * @since Twenty Fourteen 1.0 */ do_action( 'twentyfourteen_featured_posts_after' ); wp_reset_postdata(); ?> </div><!-- .featured-content-inner --> </div><!-- #featured-content .featured-content -->
01-wordpress-paypal
trunk/wp-content/themes/twentyfourteen/featured-content.php
PHP
gpl3
946
<?php /** * The Content Sidebar * * @package WordPress * @subpackage Twenty_Fourteen * @since Twenty Fourteen 1.0 */ if ( ! is_active_sidebar( 'sidebar-2' ) ) { return; } ?> <div id="content-sidebar" class="content-sidebar widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar-2' ); ?> </div><!-- #content-sidebar -->
01-wordpress-paypal
trunk/wp-content/themes/twentyfourteen/sidebar-content.php
PHP
gpl3
340
<?php /** * The template for displaying posts in the Audio post format * * @package WordPress * @subpackage Twenty_Fourteen * @since Twenty Fourteen 1.0 */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php twentyfourteen_post_thumbnail(); ?> <header class="entry-header"> <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?> <div class="entry-meta"> <span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span> </div><!-- .entry-meta --> <?php endif; if ( is_single() ) : the_title( '<h1 class="entry-title">', '</h1>' ); else : the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); endif; ?> <div class="entry-meta"> <span class="post-format"> <a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'audio' ) ); ?>"><?php echo get_post_format_string( 'audio' ); ?></a> </span> <?php twentyfourteen_posted_on(); ?> <?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?> <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span> <?php endif; ?> <?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?> </div><!-- .entry-meta --> </header><!-- .entry-header --> <div class="entry-content"> <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) ); wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>', ) ); ?> </div><!-- .entry-content --> <?php the_tags( '<footer class="entry-meta"><span class="tag-links">', '', '</span></footer>' ); ?> </article><!-- #post-## -->
01-wordpress-paypal
trunk/wp-content/themes/twentyfourteen/content-audio.php
PHP
gpl3
2,167
<?php /** * The template for displaying Comments * * The area of the page that contains comments and the comment form. * * @package WordPress * @subpackage Twenty_Fourteen * @since Twenty Fourteen 1.0 */ /* * If the current post is protected by a password and the visitor has not yet * entered the password we will return early without loading the comments. */ if ( post_password_required() ) { return; } ?> <div id="comments" class="comments-area"> <?php if ( have_comments() ) : ?> <h2 class="comments-title"> <?php printf( _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentyfourteen' ), number_format_i18n( get_comments_number() ), get_the_title() ); ?> </h2> <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?> <nav id="comment-nav-above" class="navigation comment-navigation" role="navigation"> <h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'twentyfourteen' ); ?></h1> <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyfourteen' ) ); ?></div> <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyfourteen' ) ); ?></div> </nav><!-- #comment-nav-above --> <?php endif; // Check for comment navigation. ?> <ol class="comment-list"> <?php wp_list_comments( array( 'style' => 'ol', 'short_ping' => true, 'avatar_size'=> 34, ) ); ?> </ol><!-- .comment-list --> <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?> <nav id="comment-nav-below" class="navigation comment-navigation" role="navigation"> <h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'twentyfourteen' ); ?></h1> <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyfourteen' ) ); ?></div> <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyfourteen' ) ); ?></div> </nav><!-- #comment-nav-below --> <?php endif; // Check for comment navigation. ?> <?php if ( ! comments_open() ) : ?> <p class="no-comments"><?php _e( 'Comments are closed.', 'twentyfourteen' ); ?></p> <?php endif; ?> <?php endif; // have_comments() ?> <?php comment_form(); ?> </div><!-- #comments -->
01-wordpress-paypal
trunk/wp-content/themes/twentyfourteen/comments.php
PHP
gpl3
2,314
<?php /** * The template used for displaying page content * * @package WordPress * @subpackage Twenty_Fourteen * @since Twenty Fourteen 1.0 */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php // Page thumbnail and title. twentyfourteen_post_thumbnail(); the_title( '<header class="entry-header"><h1 class="entry-title">', '</h1></header><!-- .entry-header -->' ); ?> <div class="entry-content"> <?php the_content(); wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>', ) ); edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?> </div><!-- .entry-content --> </article><!-- #post-## -->
01-wordpress-paypal
trunk/wp-content/themes/twentyfourteen/content-page.php
PHP
gpl3
871
<?php /** * The template for displaying Search Results pages * * @package WordPress * @subpackage Twenty_Fourteen * @since Twenty Fourteen 1.0 */ get_header(); ?> <section id="primary" class="content-area"> <div id="content" class="site-content" role="main"> <?php if ( have_posts() ) : ?> <header class="page-header"> <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyfourteen' ), get_search_query() ); ?></h1> </header><!-- .page-header --> <?php // Start the Loop. while ( have_posts() ) : the_post(); /* * Include the post format-specific template for the content. If you want to * use this in a child theme, then include a file called called content-___.php * (where ___ is the post format) and that will be used instead. */ get_template_part( 'content', get_post_format() ); endwhile; // Previous/next post navigation. twentyfourteen_paging_nav(); else : // If no content, include the "No posts found" template. get_template_part( 'content', 'none' ); endif; ?> </div><!-- #content --> </section><!-- #primary --> <?php get_sidebar( 'content' ); get_sidebar(); get_footer();
01-wordpress-paypal
trunk/wp-content/themes/twentyfourteen/search.php
PHP
gpl3
1,231
<!DOCTYPE html> <html dir="ltr" lang="en"> <head> <title>Genericons</title> <link rel="stylesheet" href="genericons.css"> <style type="text/css"> body { font-family: sans-serif; line-height: 1.5; width: 800px; margin: 50px auto; color: #777; background: white; } .icons { overflow: hidden; padding: 10px 0; } .icons div { cursor: pointer; float: left; margin: 0 30px 30px 0; } .icons:hover div { background: #f7f7f7; } .code { display: block; font: 14px/1.5 monospace; width: 740px; white-space: pre; border: 1px solid #ccc; padding: 10px; color: #777; overflow: auto; } .my-icon:before { content: '\f408'; display: inline-block; -webkit-font-smoothing: antialiased; font: normal 32px/1 'Genericons'; vertical-align: middle; } /* For the Examples */ .my-checklist { list-style-type: none; text-indent: -16px; } .my-checklist li:before { padding-right: 16px; content: '\f418'; display: inline-block; -webkit-font-smoothing: antialiased; font: normal 16px/1 'Genericons'; vertical-align: text-top; } .my-blockquote { background: #eee; border-left: 32px solid #ddd; padding: 10px; } .my-blockquote:before { margin-left: -42px; padding-right: 10px; content: '\f106'; display: inline-block; -webkit-font-smoothing: antialiased; font: normal 32px/20px 'Genericons'; vertical-align: bottom; } .my-button { font-family: Helvetica, sans-serif; font-size: 14px; background: #e05d22; /* Old browsers */ background: -webkit-linear-gradient(top, #e05d22 0%, #d94412 100%); /* Chrome10+,Safari5.1+ */ background: -moz-linear-gradient( top, #e05d22 0%, #d94412 100%); /* FF3.6+ */ background: -ms-linear-gradient( top, #e05d22 0%, #d94412 100%); /* IE10+ */ background: -o-linear-gradient( top, #e05d22 0%, #d94412 100%); /* Opera 11.10+ */ background: linear-gradient( to bottom, #e05d22 0%, #d94412 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e05d22', endColorstr='#d94412', GradientType=0); /* IE6-9 */ display: inline-block; padding: 10px 16px 4px 16px; color: #fff; text-decoration: none; border: none; border-bottom: 3px solid #b93207; border-radius: 2px; } .my-button:hover, .my-button:focus { background: #ed6a31; /* Old browsers */ background: -webkit-linear-gradient(top, #ed6a31 0%, #e55627 100%); /* Chrome10+,Safari5.1+ */ background: -moz-linear-gradient( top, #ed6a31 0%, #e55627 100%); /* FF3.6+ */ background: -ms-linear-gradient( top, #ed6a31 0%, #e55627 100%); /* IE10+ */ background: -o-linear-gradient( top, #ed6a31 0%, #e55627 100%); /* Opera 11.10+ */ background: linear-gradient( to bottom, #ed6a31 0%, #e55627 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ed6a31', endColorstr='#e55627', GradientType=0); /* IE6-9 */ outline: none; } .my-button:active { background: #d94412; /* Old browsers */ background: -webkit-linear-gradient(top, #d94412 0%, #e05d22 100%); /* Chrome10+,Safari5.1+ */ background: -moz-linear-gradient( top, #d94412 0%, #e05d22 100%); /* FF3.6+ */ background: -ms-linear-gradient( top, #d94412 0%, #e05d22 100%); /* IE10+ */ background: -o-linear-gradient( top, #d94412 0%, #e05d22 100%); /* Opera 11.10+ */ background: linear-gradient( to bottom, #d94412 0%, #e05d22 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#d94412', endColorstr='#e05d22', GradientType=0); /* IE6-9 */ border: none; border-top: 3px solid #b93207; padding: 6px 16px 7px 16px; } </style> </head> <body> <div class="section"> <h1>Genericons Usage</h1> <p>Copy the <strong>font</strong> folder and the <strong>genericons.css</strong> file together into your project. Link the CSS in your HTML:</p> <p><code>&lt;link href="path/to/genericons.css" rel="stylesheet"&gt;</code></p> <p>Drop in the following HTML with the name of the icon you want to display:</p> <p><code>&lt;div class="genericon genericon-standard"&gt;&lt;/div&gt;</code></p> <div class="icons"> <!-- post formats --> <div alt="f100" class="genericon genericon-standard"></div> <div alt="f101" class="genericon genericon-aside"></div> <div alt="f102" class="genericon genericon-image"></div> <div alt="f103" class="genericon genericon-gallery"></div> <div alt="f104" class="genericon genericon-video"></div> <div alt="f105" class="genericon genericon-status"></div> <div alt="f106" class="genericon genericon-quote"></div> <div alt="f107" class="genericon genericon-link"></div> <div alt="f108" class="genericon genericon-chat"></div> <div alt="f109" class="genericon genericon-audio"></div> <!-- social icons --> <div alt="f200" class="genericon genericon-github"></div> <div alt="f201" class="genericon genericon-dribbble"></div> <div alt="f202" class="genericon genericon-twitter"></div> <div alt="f203" class="genericon genericon-facebook"></div> <div alt="f204" class="genericon genericon-facebook-alt"></div> <div alt="f205" class="genericon genericon-wordpress"></div> <div alt="f206" class="genericon genericon-googleplus"></div> <div alt="f207" class="genericon genericon-linkedin"></div> <div alt="f208" class="genericon genericon-linkedin-alt"></div> <div alt="f209" class="genericon genericon-pinterest"></div> <div alt="f210" class="genericon genericon-pinterest-alt"></div> <div alt="f211" class="genericon genericon-flickr"></div> <div alt="f212" class="genericon genericon-vimeo"></div> <div alt="f213" class="genericon genericon-youtube"></div> <div alt="f214" class="genericon genericon-tumblr"></div> <div alt="f215" class="genericon genericon-instagram"></div> <div alt="f216" class="genericon genericon-codepen"></div> <div alt="f217" class="genericon genericon-polldaddy"></div> <div alt="f218" class="genericon genericon-googleplus-alt"></div> <div alt="f219" class="genericon genericon-path"></div> <div alt="f220" class="genericon genericon-skype"></div> <div alt="f221" class="genericon genericon-digg"></div> <div alt="f222" class="genericon genericon-reddit"></div> <div alt="f223" class="genericon genericon-stumbleupon"></div> <div alt="f224" class="genericon genericon-pocket"></div> <!-- meta icons --> <div alt="f300" class="genericon genericon-comment"></div> <div alt="f301" class="genericon genericon-category"></div> <div alt="f302" class="genericon genericon-tag"></div> <div alt="f303" class="genericon genericon-time"></div> <div alt="f304" class="genericon genericon-user"></div> <div alt="f305" class="genericon genericon-day"></div> <div alt="f306" class="genericon genericon-week"></div> <div alt="f307" class="genericon genericon-month"></div> <div alt="f308" class="genericon genericon-pinned"></div> <!-- other icons --> <div alt="f400" class="genericon genericon-search"></div> <div alt="f401" class="genericon genericon-unzoom"></div> <div alt="f402" class="genericon genericon-zoom"></div> <div alt="f403" class="genericon genericon-show"></div> <div alt="f404" class="genericon genericon-hide"></div> <div alt="f405" class="genericon genericon-close"></div> <div alt="f406" class="genericon genericon-close-alt"></div> <div alt="f407" class="genericon genericon-trash"></div> <div alt="f408" class="genericon genericon-star"></div> <div alt="f409" class="genericon genericon-home"></div> <div alt="f410" class="genericon genericon-mail"></div> <div alt="f411" class="genericon genericon-edit"></div> <div alt="f412" class="genericon genericon-reply"></div> <div alt="f413" class="genericon genericon-feed"></div> <div alt="f414" class="genericon genericon-warning"></div> <div alt="f415" class="genericon genericon-share"></div> <div alt="f416" class="genericon genericon-attachment"></div> <div alt="f417" class="genericon genericon-location"></div> <div alt="f418" class="genericon genericon-checkmark"></div> <div alt="f419" class="genericon genericon-menu"></div> <div alt="f420" class="genericon genericon-refresh"></div> <div alt="f421" class="genericon genericon-minimize"></div> <div alt="f422" class="genericon genericon-maximize"></div> <div alt="f423" class="genericon genericon-404"></div> <div alt="f424" class="genericon genericon-spam"></div> <div alt="f425" class="genericon genericon-summary"></div> <div alt="f426" class="genericon genericon-cloud"></div> <div alt="f427" class="genericon genericon-key"></div> <div alt="f428" class="genericon genericon-dot"></div> <div alt="f429" class="genericon genericon-next"></div> <div alt="f430" class="genericon genericon-previous"></div> <div alt="f431" class="genericon genericon-expand"></div> <div alt="f432" class="genericon genericon-collapse"></div> <div alt="f433" class="genericon genericon-dropdown"></div> <div alt="f434" class="genericon genericon-dropdown-left"></div> <div alt="f435" class="genericon genericon-top"></div> <div alt="f436" class="genericon genericon-draggable"></div> <div alt="f437" class="genericon genericon-phone"></div> <div alt="f438" class="genericon genericon-send-to-phone"></div> <div alt="f439" class="genericon genericon-plugin"></div> <div alt="f440" class="genericon genericon-cloud-download"></div> <div alt="f441" class="genericon genericon-cloud-upload"></div> <div alt="f442" class="genericon genericon-external"></div> <div alt="f443" class="genericon genericon-document"></div> <div alt="f444" class="genericon genericon-book"></div> <div alt="f445" class="genericon genericon-cog"></div> <div alt="f446" class="genericon genericon-unapprove"></div> <div alt="f447" class="genericon genericon-cart"></div> <div alt="f448" class="genericon genericon-pause"></div> <div alt="f449" class="genericon genericon-stop"></div> <div alt="f450" class="genericon genericon-skip-back"></div> <div alt="f451" class="genericon genericon-skip-ahead"></div> <div alt="f452" class="genericon genericon-play"></div> <div alt="f453" class="genericon genericon-tablet"></div> <div alt="f454" class="genericon genericon-send-to-tablet"></div> <div alt="f455" class="genericon genericon-info"></div> <div alt="f456" class="genericon genericon-notice"></div> <div alt="f457" class="genericon genericon-help"></div> <div alt="f458" class="genericon genericon-fastforward"></div> <div alt="f459" class="genericon genericon-rewind"></div> <div alt="f460" class="genericon genericon-portfolio"></div> <div alt="f461" class="genericon genericon-heart"></div> <div alt="f462" class="genericon genericon-code"></div> <div alt="f463" class="genericon genericon-subscribe"></div> <div alt="f464" class="genericon genericon-unsubscribe"></div> <div alt="f465" class="genericon genericon-subscribed"></div> <div alt="f466" class="genericon genericon-reply-alt"></div> <div alt="f467" class="genericon genericon-reply-single"></div> <div alt="f468" class="genericon genericon-flag"></div> <div alt="f469" class="genericon genericon-print"></div> <div alt="f470" class="genericon genericon-lock"></div> <div alt="f471" class="genericon genericon-bold"></div> <div alt="f472" class="genericon genericon-italic"></div> <div alt="f473" class="genericon genericon-picture"></div> <!-- generic shapes --> <div alt="f500" class="genericon genericon-uparrow"></div> <div alt="f501" class="genericon genericon-rightarrow"></div> <div alt="f502" class="genericon genericon-downarrow"></div> <div alt="f503" class="genericon genericon-leftarrow"></div> </div> <p>If you want to insert an icon manually using the <code>:before</code> selector, you can setup CSS rules like the following example. <strong>Make sure to set the size to a multiple of 16px</strong> or the icons could end up looking fuzzy:</p> <p><textarea class="code" style="min-height: 150px;" onclick="select();">.my-icon:before { content: '\f408'; display: inline-block; -webkit-font-smoothing: antialiased; font: normal 32px/1 'Genericons'; vertical-align: middle; }</textarea></p> <p>Add a matching class to your HTML:</p> <p><code>&lt;div class="my-icon"&gt;You're a Star!&lt;/div&gt;</code></p> <p>Here's the result: <span class="my-icon">You're a Star!</span></p> <h2>Examples</h2> <p>Turn every icon a <span style="color: #fa8072;">Salmon</span> color:</p> <p><textarea class="code" style="min-height: 70px" onclick="select();"> .genericon { color: #fa8072; }</textarea></p> <p>Or turn the stars <span style="color: #ffd700;">Gold</span>:</p> <p><textarea class="code" style="min-height: 70px" onclick="select();"> .genericon-star { color: #fa8072; }</textarea></p> <p>Use icons for bulleted lists:</p> <ul class="my-checklist"> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> </ul> <p><textarea class="code" style="min-height: 130px" onclick="select();"> <ul class="my-checklist"> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> </ul></textarea></p> <p><textarea class="code" style="min-height: 260px;" onclick="select();"> .my-checklist { list-style-type: none; text-indent: -16px; } .my-checklist li:before { padding-right: 16px; content: '\f418'; display: inline-block; -webkit-font-smoothing: antialiased; font: normal 16px/1 'Genericons'; vertical-align: text-top; }</textarea></p> <p>Use icons to style blockquotes:</p> <blockquote class="my-blockquote">Sometimes I've believed as many as six impossible things before breakfast. &mdash;<em>Lewis Carroll</em></blockquote> <blockquote class="my-blockquote">`Twas brillig, and the slithy toves Did gyre and gimble in the wabe: All mimsy were the borogoves, And the mome raths outgrabe. "Beware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jubjub bird, and shun The frumious Bandersnatch!"</blockquote> <p><textarea class="code" style="min-height: 40px;" onclick="select();"><blockquote class="my-blockquote">Sometimes I've believed as many as six impossible things before breakfast. &mdash;<em>Lewis Carroll</em></blockquote></textarea></p> <p><textarea class="code" style="min-height: 300px;" onclick="select();"> .my-blockquote { background: #eee; border-left: 32px solid #ddd; padding: 10px; } .my-blockquote:before { margin-left: -42px; padding-right: 10px; content: '\f106'; display: inline-block; -webkit-font-smoothing: antialiased; font: normal 32px/20px 'Genericons'; vertical-align: bottom; } </textarea></p> <p>Use icons to style buttons:</p> <a class="my-button" href="javascript:void()"><i class="genericon genericon-show"></i> View</a> <a class="my-button" href="javascript:void()"><i class="genericon genericon-audio"></i> Listen</a> <p><textarea class="code" style="min-height: 40px;" onclick="select();"><a class="my-button" href="#"><i class="genericon genericon-show"></i> View</a> <a class="my-button" href="#"><i class="genericon genericon-audio"></i> Listen</a></textarea></p> <p><textarea class="code" style="min-height: 300px;" onclick="select();"> .my-button { font-family: Helvetica, sans-serif; background: #e05d22; /* Old browsers */ background: -webkit-linear-gradient(top, #e05d22 0%, #d94412 100%); /* Chrome10+,Safari5.1+ */ background: -moz-linear-gradient( top, #e05d22 0%, #d94412 100%); /* FF3.6+ */ background: -ms-linear-gradient( top, #e05d22 0%, #d94412 100%); /* IE10+ */ background: -o-linear-gradient( top, #e05d22 0%, #d94412 100%); /* Opera 11.10+ */ background: linear-gradient( to bottom, #e05d22 0%, #d94412 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e05d22', endColorstr='#d94412', GradientType=0); /* IE6-9 */ display: inline-block; padding: 10px 16px 6px 16px; color: #fff; text-decoration: none; border: none; border-bottom: 3px solid #b93207; border-radius: 2px; } .my-button:hover, .my-button:focus { background: #ed6a31; /* Old browsers */ background: -webkit-linear-gradient(top, #ed6a31 0%, #e55627 100%); /* Chrome10+,Safari5.1+ */ background: -moz-linear-gradient( top, #ed6a31 0%, #e55627 100%); /* FF3.6+ */ background: -ms-linear-gradient( top, #ed6a31 0%, #e55627 100%); /* IE10+ */ background: -o-linear-gradient( top, #ed6a31 0%, #e55627 100%); /* Opera 11.10+ */ background: linear-gradient( to bottom, #ed6a31 0%, #e55627 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ed6a31', endColorstr='#e55627', GradientType=0); /* IE6-9 */ outline: none; } .my-button:active { background: #d94412; /* Old browsers */ background: -webkit-linear-gradient(top, #d94412 0%, #e05d22 100%); /* Chrome10+,Safari5.1+ */ background: -moz-linear-gradient( top, #d94412 0%, #e05d22 100%); /* FF3.6+ */ background: -ms-linear-gradient( top, #d94412 0%, #e05d22 100%); /* IE10+ */ background: -o-linear-gradient( top, #d94412 0%, #e05d22 100%); /* Opera 11.10+ */ background: linear-gradient( to bottom, #d94412 0%, #e05d22 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#d94412', endColorstr='#e05d22', GradientType=0); /* IE6-9 */ border: none; border-top: 3px solid #b93207; padding: 6px 16px 10px 16px; }</textarea>/</p> <h2>CSS Preprocessors</h2> <p>Preprocessing extensions such as Sass (SCSS Syntax) or LESS</a> can make it easier to manage CSS for a lot of things at once using things like variables and mixins.</p> <p>This example will seup the basic genericon rules and sets a color you can use for all icons using Sass:</p> <p><textarea class="code" style="min-height: 360px;" onclick="select();">$icon-color: "#fa8072"; .genericon { color: $icon-color; } @mixin genericon-rules { display: inline-block; -webkit-font-smoothing: antialiased; font: normal 16px/1 'Genericons'; vertical-align: middle; } .my-icon:before { content: '\f408'; @include genericon-rules; }</textarea></p> <p>Here is a similar example for LESS:</p> <p><textarea class="code" style="min-height: 360px;" onclick="select();">@icon-color: "#fa8072"; .genericon { color: @icon-color; } .genericon-rules { display: inline-block; -webkit-font-smoothing: antialiased; font: normal 16px/1 'Genericons'; vertical-align: middle; } .my-icon:before { content: '\f408'; .genericon-rules; }</textarea></p> <h2>Fallback images for IE7 and below</h2> <p>Genericons <strong>does not come with fallback icons by default</strong> -- therefore you have to create them yourself. If you are using HTML similar to this example: <p><code>&lt;span class="genericon genericon-warning"&gt;&lt;/span&gt;</code></p> <p>You can use the asterisk hack to serve a different icon to IE7 once you have saved the fallback icons to your project:</p> <textarea class="code" style="min-height: 85px;" onclick="select();">.genericon-warning { *background: url(fallback-icon.png) no-repeat center center; *text-indent: 100%; }</textarea> </div> </body> </html>
01-wordpress-paypal
trunk/wp-content/themes/twentyfourteen/genericons/example.html
HTML
gpl3
19,233
<?php /** * The template for displaying posts in the Quote post format * * @package WordPress * @subpackage Twenty_Fourteen * @since Twenty Fourteen 1.0 */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php twentyfourteen_post_thumbnail(); ?> <header class="entry-header"> <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?> <div class="entry-meta"> <span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span> </div><!-- .entry-meta --> <?php endif; if ( is_single() ) : the_title( '<h1 class="entry-title">', '</h1>' ); else : the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); endif; ?> <div class="entry-meta"> <span class="post-format"> <a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'quote' ) ); ?>"><?php echo get_post_format_string( 'quote' ); ?></a> </span> <?php twentyfourteen_posted_on(); ?> <?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?> <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span> <?php endif; ?> <?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?> </div><!-- .entry-meta --> </header><!-- .entry-header --> <div class="entry-content"> <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) ); wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>', ) ); ?> </div><!-- .entry-content --> <?php the_tags( '<footer class="entry-meta"><span class="tag-links">', '', '</span></footer>' ); ?> </article><!-- #post-## -->
01-wordpress-paypal
trunk/wp-content/themes/twentyfourteen/content-quote.php
PHP
gpl3
2,167
<?php /** * The template for displaying featured posts on the front page * * @package WordPress * @subpackage Twenty_Fourteen * @since Twenty Fourteen 1.0 */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <a class="post-thumbnail" href="<?php the_permalink(); ?>"> <?php // Output the featured image. if ( has_post_thumbnail() ) : if ( 'grid' == get_theme_mod( 'featured_content_layout' ) ) { the_post_thumbnail(); } else { the_post_thumbnail( 'twentyfourteen-full-width' ); } endif; ?> </a> <header class="entry-header"> <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?> <div class="entry-meta"> <span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span> </div><!-- .entry-meta --> <?php endif; ?> <?php the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">','</a></h1>' ); ?> </header><!-- .entry-header --> </article><!-- #post-## -->
01-wordpress-paypal
trunk/wp-content/themes/twentyfourteen/content-featured-post.php
PHP
gpl3
1,123
<?php // Silence is golden. ?>
01-wordpress-paypal
trunk/wp-content/themes/index.php
PHP
gpl3
30
/* Theme Name: Twenty Twelve Description: Used to style the TinyMCE editor. */ html { font-size: 87.5%; } html .mceContentBody { max-width: 625px; } body { color: #444; font-family: "Open Sans", Helvetica, Arial, sans-serif; font-size: 14px; font-size: 1rem; line-height: 1; text-rendering: optimizeLegibility; vertical-align: baseline; } /* =Headings -------------------------------------------------------------- */ h1, h2, h3, h4, h5, h6 { clear: both; line-height: 1.846153846; margin: 24px 0; margin: 1.714285714rem 0; } h1 { font-size: 21px; font-size: 1.5rem; line-height: 1.5; } h2 { font-size: 18px; font-size: 1.285714286rem; line-height: 1.6; } h3 { font-size: 16px; font-size: 1.142857143rem; } h4 { font-size: 14px; font-size: 1rem; } h5 { font-size: 13px; font-size: 0.928571429rem; } h6 { font-size: 12px; font-size: 0.857142857rem; } hr { background-color: #ccc; border: 0; height: 1px; margin: 24px; margin-bottom: 1.714285714rem; } /* =Text elements -------------------------------------------------------------- */ p { line-height: 1.714285714; margin: 0 0 24px; margin: 0 0 1.714285714rem; } ul, ol { margin: 0 0 24px; margin: 0 0 1.714285714rem; line-height: 1.714285714; padding: 0; } ul { list-style: disc outside; } ol { list-style: decimal outside; } ul ul, ol ol, ul ol, ol ul { margin-bottom: 0; } li { margin: 0 0 0 24px; margin: 0 0 0 1.714285714rem; } dl { margin: 0 24px; margin: 0 1.714285714rem; } dt { font-weight: bold; margin-bottom: 24px; margin-bottom: 1.714285714rem; } dd { line-height: 1.714285714; margin: 0 0 24px; margin: 0 0 1.714285714rem; } strong { font-weight: bold; } cite, em, i { font-style: italic; } cite { border: none; } big { font-size: 128.571429%; } .mceContentBody blockquote { font-style: italic !important; font-weight: normal; margin: 0; padding: 24px; padding: 1.714285714rem; } pre { border: 1px solid #ededed; color: #666; font-family: Consolas, Monaco, Lucida Console, monospace; font-size: 12px; font-size: 0.857142857rem; line-height: 1.714285714; margin: 24px 0; margin: 1.714285714rem 0; overflow: auto; padding: 24px; padding: 1.714285714rem; } code, kbd, samp, var { font-family: Consolas, Monaco, Lucida Console, monospace; font-size: 12px; font-size: 0.857142857rem; line-height: 2; } abbr, acronym, dfn { border-bottom: 1px dotted #666; cursor: help; } address { display: block; line-height: 1.714285714; margin: 0 0 24px; margin: 0 0 1.714285714rem; } del { color: #333; } ins { background: #fff9c0; border: none; color: #333; text-decoration: none; } sup, sub { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } sup { top: -0.5em; } sub { bottom: -0.25em; } input[type="text"] { border: 1px solid #ccc; border-radius: 3px; font-family: inherit; padding: 6px; padding: 0.428571429rem; } textarea { border: 1px solid #d5d2ca; border-radius: 3px; font-family: inherit; font-size: 12px; font-size: 0.857142857rem; line-height: 1.714285714; padding: 10px; padding: 0.714285714rem; width: 96%; } /* =Links -------------------------------------------------------------- */ a, a em, a strong { color: #21759b; outline: none; } a:focus, a:active, a:hover { color: #0f3647; } /* =Alignment -------------------------------------------------------------- */ .alignleft { display: inline; float: left; margin: 12px 24px 12px 0; margin: 0.857142857rem 1.714285714rem 0.857142857rem 0; } .alignright { display: inline; float: right; margin: 12px 0 12px 24px; margin: 0.857142857rem 0 0.857142857rem 1.714285714rem; } .aligncenter { clear: both; display: block; margin-top: 12px; margin-top: 0.857142857rem; margin-bottom: 12px; margin-bottom: 0.857142857rem; } /* =Tables -------------------------------------------------------------- */ table { border-bottom: 1px solid #ededed; border-collapse: collapse; border-spacing: 0; color: #757575; font-size: 12px; font-size: 0.857142857rem; line-height: 2; margin: 0 0 24px; margin: 0 0 1.714285714rem; width: 100%; } tr th { color: #636363; font-size: 11px; font-size: 0.785714286rem; font-weight: bold; line-height: 2.181818182; text-align: left; text-transform: uppercase; } td { border-top: 1px solid #ededed !important; color: #757575; font-size: inherit; font-weight: normal; padding: 6px 10px 6px 0; text-align: left; } /* =Images -------------------------------------------------------------- */ img, .editor-attachment { border: 0; border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); max-width: 100%; } img.size-full { width: auto/9; /* Prevent stretching of full-size images in IE8 */ } img[class*="wp-image-"] { height: auto; max-width: 100%; } img[class*="align"], img[class*="wp-image-"], img[class*="attachment-"] { height: auto; /* Make sure images with WordPress-added height and width attributes are scaled correctly */ } img.mce-wp-nextpage { border-radius: 0; box-shadow: none; } img.wp-smiley { border: 0; border-radius: 0; box-shadow: none; margin-bottom: 0; margin-top: 0; padding: 0; } .wp-caption { background: transparent; border: none; margin: 0; padding: 4px; text-align: left; } .wp-caption-dt { margin: 0; } .wp-caption .wp-caption-text, .wp-caption-dd { color: #757575; font-style: italic; font-size: 12px; font-size: 0.857142857rem; line-height: 2; margin: 0 0 24px; margin: 0 0 1.71429rem; }
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/editor-style.css
CSS
gpl3
5,467
<?php /** * The main template file * * This is the most generic template file in a WordPress theme * and one of the two required files for a theme (the other being style.css). * It is used to display a page when nothing more specific matches a query. * For example, it puts together the home page when no home.php file exists. * * @link http://codex.wordpress.org/Template_Hierarchy * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ get_header(); ?> <div id="primary" class="site-content"> <div id="content" role="main"> <?php if ( have_posts() ) : ?> <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', get_post_format() ); ?> <?php endwhile; ?> <?php twentytwelve_content_nav( 'nav-below' ); ?> <?php else : ?> <article id="post-0" class="post no-results not-found"> <?php if ( current_user_can( 'edit_posts' ) ) : // Show a different message to a logged-in user who can add posts. ?> <header class="entry-header"> <h1 class="entry-title"><?php _e( 'No posts to display', 'twentytwelve' ); ?></h1> </header> <div class="entry-content"> <p><?php printf( __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'twentytwelve' ), admin_url( 'post-new.php' ) ); ?></p> </div><!-- .entry-content --> <?php else : // Show the default message to everyone else. ?> <header class="entry-header"> <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1> </header> <div class="entry-content"> <p><?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p> <?php get_search_form(); ?> </div><!-- .entry-content --> <?php endif; // end current_user_can() check ?> </article><!-- #post-0 --> <?php endif; // end have_posts() check ?> </div><!-- #content --> </div><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/index.php
PHP
gpl3
2,053
<?php /** * The Header template for our theme * * Displays all of the <head> section and everything up till <div id="main"> * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ ?><!DOCTYPE html> <!--[if IE 7]> <html class="ie ie7" <?php language_attributes(); ?>> <![endif]--> <!--[if IE 8]> <html class="ie ie8" <?php language_attributes(); ?>> <![endif]--> <!--[if !(IE 7) | !(IE 8) ]><!--> <html <?php language_attributes(); ?>> <!--<![endif]--> <head> <meta charset="<?php bloginfo( 'charset' ); ?>" /> <meta name="viewport" content="width=device-width" /> <title><?php wp_title( '|', true, 'right' ); ?></title> <link rel="profile" href="http://gmpg.org/xfn/11" /> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> <?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?> <!--[if lt IE 9]> <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script> <![endif]--> <?php wp_head(); ?> </head> <body <?php body_class(); ?>> <div id="page" class="hfeed site"> <header id="masthead" class="site-header" role="banner"> <hgroup> <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2> </hgroup> <nav id="site-navigation" class="main-navigation" role="navigation"> <h3 class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></h3> <a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?></a> <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?> </nav><!-- #site-navigation --> <?php if ( get_header_image() ) : ?> <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php header_image(); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a> <?php endif; ?> </header><!-- #masthead --> <div id="main" class="wrapper">
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/header.php
PHP
gpl3
2,233
<?php /** * The Template for displaying all single posts * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ get_header(); ?> <div id="primary" class="site-content"> <div id="content" role="main"> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', get_post_format() ); ?> <nav class="nav-single"> <h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3> <span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentytwelve' ) . '</span> %title' ); ?></span> <span class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentytwelve' ) . '</span>' ); ?></span> </nav><!-- .nav-single --> <?php comments_template( '', true ); ?> <?php endwhile; // end of the loop. ?> </div><!-- #content --> </div><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/single.php
PHP
gpl3
1,035
<?php /** * Twenty Twelve functions and definitions * * Sets up the theme and provides some helper functions, which are used * in the theme as custom template tags. Others are attached to action and * filter hooks in WordPress to change core functionality. * * When using a child theme (see http://codex.wordpress.org/Theme_Development and * http://codex.wordpress.org/Child_Themes), you can override certain functions * (those wrapped in a function_exists() call) by defining them first in your child theme's * functions.php file. The child theme's functions.php file is included before the parent * theme's file, so the child theme functions would be used. * * Functions that are not pluggable (not wrapped in function_exists()) are instead attached * to a filter or action hook. * * For more information on hooks, actions, and filters, @link http://codex.wordpress.org/Plugin_API * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ // Set up the content width value based on the theme's design and stylesheet. if ( ! isset( $content_width ) ) $content_width = 625; /** * Twenty Twelve setup. * * Sets up theme defaults and registers the various WordPress features that * Twenty Twelve supports. * * @uses load_theme_textdomain() For translation/localization support. * @uses add_editor_style() To add a Visual Editor stylesheet. * @uses add_theme_support() To add support for post thumbnails, automatic feed links, * custom background, and post formats. * @uses register_nav_menu() To add support for navigation menus. * @uses set_post_thumbnail_size() To set a custom post thumbnail size. * * @since Twenty Twelve 1.0 */ function twentytwelve_setup() { /* * Makes Twenty Twelve available for translation. * * Translations can be added to the /languages/ directory. * If you're building a theme based on Twenty Twelve, use a find and replace * to change 'twentytwelve' to the name of your theme in all the template files. */ load_theme_textdomain( 'twentytwelve', get_template_directory() . '/languages' ); // This theme styles the visual editor with editor-style.css to match the theme style. add_editor_style(); // Adds RSS feed links to <head> for posts and comments. add_theme_support( 'automatic-feed-links' ); // This theme supports a variety of post formats. add_theme_support( 'post-formats', array( 'aside', 'image', 'link', 'quote', 'status' ) ); // This theme uses wp_nav_menu() in one location. register_nav_menu( 'primary', __( 'Primary Menu', 'twentytwelve' ) ); /* * This theme supports custom background color and image, * and here we also set up the default background color. */ add_theme_support( 'custom-background', array( 'default-color' => 'e6e6e6', ) ); // This theme uses a custom image size for featured images, displayed on "standard" posts. add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 624, 9999 ); // Unlimited height, soft crop } add_action( 'after_setup_theme', 'twentytwelve_setup' ); /** * Add support for a custom header image. */ require( get_template_directory() . '/inc/custom-header.php' ); /** * Return the Google font stylesheet URL if available. * * The use of Open Sans by default is localized. For languages that use * characters not supported by the font, the font can be disabled. * * @since Twenty Twelve 1.2 * * @return string Font stylesheet or empty string if disabled. */ function twentytwelve_get_font_url() { $font_url = ''; /* translators: If there are characters in your language that are not supported * by Open Sans, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Open Sans font: on or off', 'twentytwelve' ) ) { $subsets = 'latin,latin-ext'; /* translators: To add an additional Open Sans character subset specific to your language, * translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language. */ $subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)', 'twentytwelve' ); if ( 'cyrillic' == $subset ) $subsets .= ',cyrillic,cyrillic-ext'; elseif ( 'greek' == $subset ) $subsets .= ',greek,greek-ext'; elseif ( 'vietnamese' == $subset ) $subsets .= ',vietnamese'; $protocol = is_ssl() ? 'https' : 'http'; $query_args = array( 'family' => 'Open+Sans:400italic,700italic,400,700', 'subset' => $subsets, ); $font_url = add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" ); } return $font_url; } /** * Enqueue scripts and styles for front-end. * * @since Twenty Twelve 1.0 */ function twentytwelve_scripts_styles() { global $wp_styles; /* * Adds JavaScript to pages with the comment form to support * sites with threaded comments (when in use). */ if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); // Adds JavaScript for handling the navigation menu hide-and-show behavior. wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ), '20140318', true ); $font_url = twentytwelve_get_font_url(); if ( ! empty( $font_url ) ) wp_enqueue_style( 'twentytwelve-fonts', esc_url_raw( $font_url ), array(), null ); // Loads our main stylesheet. wp_enqueue_style( 'twentytwelve-style', get_stylesheet_uri() ); // Loads the Internet Explorer specific stylesheet. wp_enqueue_style( 'twentytwelve-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentytwelve-style' ), '20121010' ); $wp_styles->add_data( 'twentytwelve-ie', 'conditional', 'lt IE 9' ); } add_action( 'wp_enqueue_scripts', 'twentytwelve_scripts_styles' ); /** * Filter TinyMCE CSS path to include Google Fonts. * * Adds additional stylesheets to the TinyMCE editor if needed. * * @uses twentytwelve_get_font_url() To get the Google Font stylesheet URL. * * @since Twenty Twelve 1.2 * * @param string $mce_css CSS path to load in TinyMCE. * @return string Filtered CSS path. */ function twentytwelve_mce_css( $mce_css ) { $font_url = twentytwelve_get_font_url(); if ( empty( $font_url ) ) return $mce_css; if ( ! empty( $mce_css ) ) $mce_css .= ','; $mce_css .= esc_url_raw( str_replace( ',', '%2C', $font_url ) ); return $mce_css; } add_filter( 'mce_css', 'twentytwelve_mce_css' ); /** * Filter the page title. * * Creates a nicely formatted and more specific title element text * for output in head of document, based on current view. * * @since Twenty Twelve 1.0 * * @param string $title Default title text for current view. * @param string $sep Optional separator. * @return string Filtered title. */ function twentytwelve_wp_title( $title, $sep ) { global $paged, $page; if ( is_feed() ) return $title; // Add the site name. $title .= get_bloginfo( 'name', 'display' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title = "$title $sep $site_description"; // Add a page number if necessary. if ( $paged >= 2 || $page >= 2 ) $title = "$title $sep " . sprintf( __( 'Page %s', 'twentytwelve' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'twentytwelve_wp_title', 10, 2 ); /** * Filter the page menu arguments. * * Makes our wp_nav_menu() fallback -- wp_page_menu() -- show a home link. * * @since Twenty Twelve 1.0 */ function twentytwelve_page_menu_args( $args ) { if ( ! isset( $args['show_home'] ) ) $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'twentytwelve_page_menu_args' ); /** * Register sidebars. * * Registers our main widget area and the front page widget areas. * * @since Twenty Twelve 1.0 */ function twentytwelve_widgets_init() { register_sidebar( array( 'name' => __( 'Main Sidebar', 'twentytwelve' ), 'id' => 'sidebar-1', 'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'twentytwelve' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => __( 'First Front Page Widget Area', 'twentytwelve' ), 'id' => 'sidebar-2', 'description' => __( 'Appears when using the optional Front Page template with a page set as Static Front Page', 'twentytwelve' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => __( 'Second Front Page Widget Area', 'twentytwelve' ), 'id' => 'sidebar-3', 'description' => __( 'Appears when using the optional Front Page template with a page set as Static Front Page', 'twentytwelve' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); } add_action( 'widgets_init', 'twentytwelve_widgets_init' ); if ( ! function_exists( 'twentytwelve_content_nav' ) ) : /** * Displays navigation to next/previous pages when applicable. * * @since Twenty Twelve 1.0 */ function twentytwelve_content_nav( $html_id ) { global $wp_query; $html_id = esc_attr( $html_id ); if ( $wp_query->max_num_pages > 1 ) : ?> <nav id="<?php echo $html_id; ?>" class="navigation" role="navigation"> <h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3> <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentytwelve' ) ); ?></div> <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?></div> </nav><!-- #<?php echo $html_id; ?> .navigation --> <?php endif; } endif; if ( ! function_exists( 'twentytwelve_comment' ) ) : /** * Template for comments and pingbacks. * * To override this walker in a child theme without modifying the comments template * simply create your own twentytwelve_comment(), and that function will be used instead. * * Used as a callback by wp_list_comments() for displaying the comments. * * @since Twenty Twelve 1.0 */ function twentytwelve_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case 'pingback' : case 'trackback' : // Display trackbacks differently than normal comments. ?> <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>"> <p><?php _e( 'Pingback:', 'twentytwelve' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?></p> <?php break; default : // Proceed with normal comments. global $post; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"> <article id="comment-<?php comment_ID(); ?>" class="comment"> <header class="comment-meta comment-author vcard"> <?php echo get_avatar( $comment, 44 ); printf( '<cite><b class="fn">%1$s</b> %2$s</cite>', get_comment_author_link(), // If current post author is also comment author, make it known visually. ( $comment->user_id === $post->post_author ) ? '<span>' . __( 'Post author', 'twentytwelve' ) . '</span>' : '' ); printf( '<a href="%1$s"><time datetime="%2$s">%3$s</time></a>', esc_url( get_comment_link( $comment->comment_ID ) ), get_comment_time( 'c' ), /* translators: 1: date, 2: time */ sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(), get_comment_time() ) ); ?> </header><!-- .comment-meta --> <?php if ( '0' == $comment->comment_approved ) : ?> <p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentytwelve' ); ?></p> <?php endif; ?> <section class="comment-content comment"> <?php comment_text(); ?> <?php edit_comment_link( __( 'Edit', 'twentytwelve' ), '<p class="edit-link">', '</p>' ); ?> </section><!-- .comment-content --> <div class="reply"> <?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply', 'twentytwelve' ), 'after' => ' <span>&darr;</span>', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> </div><!-- .reply --> </article><!-- #comment-## --> <?php break; endswitch; // end comment_type check } endif; if ( ! function_exists( 'twentytwelve_entry_meta' ) ) : /** * Set up post entry meta. * * Prints HTML with meta information for current post: categories, tags, permalink, author, and date. * * Create your own twentytwelve_entry_meta() to override in a child theme. * * @since Twenty Twelve 1.0 */ function twentytwelve_entry_meta() { // Translators: used between list items, there is a space after the comma. $categories_list = get_the_category_list( __( ', ', 'twentytwelve' ) ); // Translators: used between list items, there is a space after the comma. $tag_list = get_the_tag_list( '', __( ', ', 'twentytwelve' ) ); $date = sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); $author = sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'twentytwelve' ), get_the_author() ) ), get_the_author() ); // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name. if ( $tag_list ) { $utility_text = __( 'This entry was posted in %1$s and tagged %2$s on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' ); } elseif ( $categories_list ) { $utility_text = __( 'This entry was posted in %1$s on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' ); } else { $utility_text = __( 'This entry was posted on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' ); } printf( $utility_text, $categories_list, $tag_list, $date, $author ); } endif; /** * Extend the default WordPress body classes. * * Extends the default WordPress body class to denote: * 1. Using a full-width layout, when no active widgets in the sidebar * or full-width template. * 2. Front Page template: thumbnail in use and number of sidebars for * widget areas. * 3. White or empty background color to change the layout and spacing. * 4. Custom fonts enabled. * 5. Single or multiple authors. * * @since Twenty Twelve 1.0 * * @param array $classes Existing class values. * @return array Filtered class values. */ function twentytwelve_body_class( $classes ) { $background_color = get_background_color(); $background_image = get_background_image(); if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'page-templates/full-width.php' ) ) $classes[] = 'full-width'; if ( is_page_template( 'page-templates/front-page.php' ) ) { $classes[] = 'template-front-page'; if ( has_post_thumbnail() ) $classes[] = 'has-post-thumbnail'; if ( is_active_sidebar( 'sidebar-2' ) && is_active_sidebar( 'sidebar-3' ) ) $classes[] = 'two-sidebars'; } if ( empty( $background_image ) ) { if ( empty( $background_color ) ) $classes[] = 'custom-background-empty'; elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) ) $classes[] = 'custom-background-white'; } // Enable custom font class only if the font CSS is queued to load. if ( wp_style_is( 'twentytwelve-fonts', 'queue' ) ) $classes[] = 'custom-font-enabled'; if ( ! is_multi_author() ) $classes[] = 'single-author'; return $classes; } add_filter( 'body_class', 'twentytwelve_body_class' ); /** * Adjust content width in certain contexts. * * Adjusts content_width value for full-width and single image attachment * templates, and when there are no active widgets in the sidebar. * * @since Twenty Twelve 1.0 */ function twentytwelve_content_width() { if ( is_page_template( 'page-templates/full-width.php' ) || is_attachment() || ! is_active_sidebar( 'sidebar-1' ) ) { global $content_width; $content_width = 960; } } add_action( 'template_redirect', 'twentytwelve_content_width' ); /** * Register postMessage support. * * Add postMessage support for site title and description for the Customizer. * * @since Twenty Twelve 1.0 * * @param WP_Customize_Manager $wp_customize Customizer object. */ function twentytwelve_customize_register( $wp_customize ) { $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; } add_action( 'customize_register', 'twentytwelve_customize_register' ); /** * Enqueue Javascript postMessage handlers for the Customizer. * * Binds JS handlers to make the Customizer preview reload changes asynchronously. * * @since Twenty Twelve 1.0 */ function twentytwelve_customize_preview_js() { wp_enqueue_script( 'twentytwelve-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20130301', true ); } add_action( 'customize_preview_init', 'twentytwelve_customize_preview_js' );
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/functions.php
PHP
gpl3
17,639
<?php /** * The template for displaying posts in the Aside post format * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="aside"> <h1 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h1> <div class="entry-content"> <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?> </div><!-- .entry-content --> </div><!-- .aside --> <footer class="entry-meta"> <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php echo get_the_date(); ?></a> <?php if ( comments_open() ) : ?> <div class="comments-link"> <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?> </div><!-- .comments-link --> <?php endif; // comments_open() ?> <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?> </footer><!-- .entry-meta --> </article><!-- #post -->
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/content-aside.php
PHP
gpl3
1,271
<?php /** * The template for displaying image attachments * * @link http://codex.wordpress.org/Template_Hierarchy * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ get_header(); ?> <div id="primary" class="site-content"> <div id="content" role="main"> <?php while ( have_posts() ) : the_post(); ?> <article id="post-<?php the_ID(); ?>" <?php post_class( 'image-attachment' ); ?>> <header class="entry-header"> <h1 class="entry-title"><?php the_title(); ?></h1> <footer class="entry-meta"> <?php $metadata = wp_get_attachment_metadata(); printf( __( '<span class="meta-prep meta-prep-entry-date">Published </span> <span class="entry-date"><time class="entry-date" datetime="%1$s">%2$s</time></span> at <a href="%3$s" title="Link to full-size image">%4$s &times; %5$s</a> in <a href="%6$s" title="Return to %7$s" rel="gallery">%8$s</a>.', 'twentytwelve' ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_url( wp_get_attachment_url() ), $metadata['width'], $metadata['height'], esc_url( get_permalink( $post->post_parent ) ), esc_attr( strip_tags( get_the_title( $post->post_parent ) ) ), get_the_title( $post->post_parent ) ); ?> <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?> </footer><!-- .entry-meta --> <nav id="image-navigation" class="navigation" role="navigation"> <span class="previous-image"><?php previous_image_link( false, __( '&larr; Previous', 'twentytwelve' ) ); ?></span> <span class="next-image"><?php next_image_link( false, __( 'Next &rarr;', 'twentytwelve' ) ); ?></span> </nav><!-- #image-navigation --> </header><!-- .entry-header --> <div class="entry-content"> <div class="entry-attachment"> <div class="attachment"> <?php /* * Grab the IDs of all the image attachments in a gallery so we can get the URL of the next adjacent image in a gallery, * or the first image (if we're looking at the last image in a gallery), or, in a gallery of one, just the link to that image file */ $attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) ); foreach ( $attachments as $k => $attachment ) : if ( $attachment->ID == $post->ID ) break; endforeach; $k++; // If there is more than 1 attachment in a gallery if ( count( $attachments ) > 1 ) : if ( isset( $attachments[ $k ] ) ) : // get the URL of the next image attachment $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID ); else : // or get the URL of the first image attachment $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID ); endif; else : // or, if there's only 1 image, get the URL of the image $next_attachment_url = wp_get_attachment_url(); endif; ?> <a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php /** * Filter the image attachment size to use. * * @since Twenty Twelve 1.0 * * @param array $size { * @type int The attachment height in pixels. * @type int The attachment width in pixels. * } */ $attachment_size = apply_filters( 'twentytwelve_attachment_size', array( 960, 960 ) ); echo wp_get_attachment_image( $post->ID, $attachment_size ); ?></a> <?php if ( ! empty( $post->post_excerpt ) ) : ?> <div class="entry-caption"> <?php the_excerpt(); ?> </div> <?php endif; ?> </div><!-- .attachment --> </div><!-- .entry-attachment --> <div class="entry-description"> <?php the_content(); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?> </div><!-- .entry-description --> </div><!-- .entry-content --> </article><!-- #post --> <?php comments_template(); ?> <?php endwhile; // end of the loop. ?> </div><!-- #content --> </div><!-- #primary --> <?php get_footer(); ?>
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/image.php
PHP
gpl3
4,366
<?php /** * Implement an optional custom header for Twenty Twelve * * See http://codex.wordpress.org/Custom_Headers * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ /** * Set up the WordPress core custom header arguments and settings. * * @uses add_theme_support() to register support for 3.4 and up. * @uses twentytwelve_header_style() to style front-end. * @uses twentytwelve_admin_header_style() to style wp-admin form. * @uses twentytwelve_admin_header_image() to add custom markup to wp-admin form. * * @since Twenty Twelve 1.0 */ function twentytwelve_custom_header_setup() { $args = array( // Text color and image (empty to use none). 'default-text-color' => '515151', 'default-image' => '', // Set height and width, with a maximum value for the width. 'height' => 250, 'width' => 960, 'max-width' => 2000, // Support flexible height and width. 'flex-height' => true, 'flex-width' => true, // Random image rotation off by default. 'random-default' => false, // Callbacks for styling the header and the admin preview. 'wp-head-callback' => 'twentytwelve_header_style', 'admin-head-callback' => 'twentytwelve_admin_header_style', 'admin-preview-callback' => 'twentytwelve_admin_header_image', ); add_theme_support( 'custom-header', $args ); } add_action( 'after_setup_theme', 'twentytwelve_custom_header_setup' ); /** * Load our special font CSS file. * * @since Twenty Twelve 1.2 */ function twentytwelve_custom_header_fonts() { $font_url = twentytwelve_get_font_url(); if ( ! empty( $font_url ) ) wp_enqueue_style( 'twentytwelve-fonts', esc_url_raw( $font_url ), array(), null ); } add_action( 'admin_print_styles-appearance_page_custom-header', 'twentytwelve_custom_header_fonts' ); /** * Style the header text displayed on the blog. * * get_header_textcolor() options: 515151 is default, hide text (returns 'blank'), or any hex value. * * @since Twenty Twelve 1.0 */ function twentytwelve_header_style() { $text_color = get_header_textcolor(); // If no custom options for text are set, let's bail if ( $text_color == get_theme_support( 'custom-header', 'default-text-color' ) ) return; // If we get this far, we have custom styles. ?> <style type="text/css" id="twentytwelve-header-css"> <?php // Has the text been hidden? if ( ! display_header_text() ) : ?> .site-title, .site-description { position: absolute; clip: rect(1px 1px 1px 1px); /* IE7 */ clip: rect(1px, 1px, 1px, 1px); } <?php // If the user has set a custom color for the text, use that. else : ?> .site-header h1 a, .site-header h2 { color: #<?php echo $text_color; ?>; } <?php endif; ?> </style> <?php } /** * Style the header image displayed on the Appearance > Header admin panel. * * @since Twenty Twelve 1.0 */ function twentytwelve_admin_header_style() { ?> <style type="text/css" id="twentytwelve-admin-header-css"> .appearance_page_custom-header #headimg { border: none; font-family: "Open Sans", Helvetica, Arial, sans-serif; } #headimg h1, #headimg h2 { line-height: 1.84615; margin: 0; padding: 0; } #headimg h1 { font-size: 26px; } #headimg h1 a { color: #515151; text-decoration: none; } #headimg h1 a:hover { color: #21759b !important; /* Has to override custom inline style. */ } #headimg h2 { color: #757575; font-size: 13px; margin-bottom: 24px; } #headimg img { max-width: <?php echo get_theme_support( 'custom-header', 'max-width' ); ?>px; } </style> <?php } /** * Output markup to be displayed on the Appearance > Header admin panel. * * This callback overrides the default markup displayed there. * * @since Twenty Twelve 1.0 */ function twentytwelve_admin_header_image() { ?> <div id="headimg"> <?php if ( ! display_header_text() ) $style = ' style="display:none;"'; else $style = ' style="color:#' . get_header_textcolor() . ';"'; ?> <h1 class="displaying-header-text"><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1> <h2 id="desc" class="displaying-header-text"<?php echo $style; ?>><?php bloginfo( 'description' ); ?></h2> <?php $header_image = get_header_image(); if ( ! empty( $header_image ) ) : ?> <img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /> <?php endif; ?> </div> <?php }
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/inc/custom-header.php
PHP
gpl3
4,651
<?php /** * The template for displaying all pages * * This is the template that displays all pages by default. * Please note that this is the WordPress construct of pages * and that other 'pages' on your WordPress site will use a * different template. * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ get_header(); ?> <div id="primary" class="site-content"> <div id="content" role="main"> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', 'page' ); ?> <?php comments_template( '', true ); ?> <?php endwhile; // end of the loop. ?> </div><!-- #content --> </div><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/page.php
PHP
gpl3
725
<?php /** * The template for displaying posts in the Link post format * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <header><?php _e( 'Link', 'twentytwelve' ); ?></header> <div class="entry-content"> <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?> </div><!-- .entry-content --> <footer class="entry-meta"> <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php echo get_the_date(); ?></a> <?php if ( comments_open() ) : ?> <div class="comments-link"> <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?> </div><!-- .comments-link --> <?php endif; // comments_open() ?> <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?> </footer><!-- .entry-meta --> </article><!-- #post -->
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/content-link.php
PHP
gpl3
1,170
/** * Theme Customizer enhancements for a better user experience. * * Contains handlers to make Theme Customizer preview reload changes asynchronously. * Things like site title, description, and background color changes. */ ( function( $ ) { // Site title and description. wp.customize( 'blogname', function( value ) { value.bind( function( to ) { $( '.site-title a' ).text( to ); } ); } ); wp.customize( 'blogdescription', function( value ) { value.bind( function( to ) { $( '.site-description' ).text( to ); } ); } ); // Header text color wp.customize( 'header_textcolor', function( value ) { value.bind( function( to ) { if ( 'blank' === to ) { $( '.site-title, .site-title a, .site-description' ).css( { 'clip': 'rect(1px, 1px, 1px, 1px)', 'position': 'absolute' } ); } else { $( '.site-title, .site-title a, .site-description' ).css( { 'clip': 'auto', 'color': to, 'position': 'relative' } ); } } ); } ); // Hook into background color/image change and adjust body class value as needed. wp.customize( 'background_color', function( value ) { value.bind( function( to ) { var body = $( 'body' ); if ( ( '#ffffff' == to || '#fff' == to ) && 'none' == body.css( 'background-image' ) ) body.addClass( 'custom-background-white' ); else if ( '' == to && 'none' == body.css( 'background-image' ) ) body.addClass( 'custom-background-empty' ); else body.removeClass( 'custom-background-empty custom-background-white' ); } ); } ); wp.customize( 'background_image', function( value ) { value.bind( function( to ) { var body = $( 'body' ); if ( '' != to ) body.removeClass( 'custom-background-empty custom-background-white' ); else if ( 'rgb(255, 255, 255)' == body.css( 'background-color' ) ) body.addClass( 'custom-background-white' ); else if ( 'rgb(230, 230, 230)' == body.css( 'background-color' ) && '' == _wpCustomizeSettings.values.background_color ) body.addClass( 'custom-background-empty' ); } ); } ); } )( jQuery );
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/js/theme-customizer.js
JavaScript
gpl3
2,067
/** * Handles toggling the navigation menu for small screens and * accessibility for submenu items. */ ( function() { var nav = document.getElementById( 'site-navigation' ), button, menu; if ( ! nav ) { return; } button = nav.getElementsByTagName( 'h3' )[0]; menu = nav.getElementsByTagName( 'ul' )[0]; if ( ! button ) { return; } // Hide button if menu is missing or empty. if ( ! menu || ! menu.childNodes.length ) { button.style.display = 'none'; return; } button.onclick = function() { if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { menu.className = 'nav-menu'; } if ( -1 !== button.className.indexOf( 'toggled-on' ) ) { button.className = button.className.replace( ' toggled-on', '' ); menu.className = menu.className.replace( ' toggled-on', '' ); } else { button.className += ' toggled-on'; menu.className += ' toggled-on'; } }; } )(); // Better focus for hidden submenu items for accessibility. ( function( $ ) { $( '.main-navigation' ).find( 'a' ).on( 'focus.twentytwelve blur.twentytwelve', function() { $( this ).parents( '.menu-item, .page_item' ).toggleClass( 'focus' ); } ); } )( jQuery );
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/js/navigation.js
JavaScript
gpl3
1,168
<?php /** * The template for displaying Tag pages * * Used to display archive-type pages for posts in a tag. * * @link http://codex.wordpress.org/Template_Hierarchy * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ get_header(); ?> <section id="primary" class="site-content"> <div id="content" role="main"> <?php if ( have_posts() ) : ?> <header class="archive-header"> <h1 class="archive-title"><?php printf( __( 'Tag Archives: %s', 'twentytwelve' ), '<span>' . single_tag_title( '', false ) . '</span>' ); ?></h1> <?php if ( tag_description() ) : // Show an optional tag description ?> <div class="archive-meta"><?php echo tag_description(); ?></div> <?php endif; ?> </header><!-- .archive-header --> <?php /* Start the Loop */ while ( have_posts() ) : the_post(); /* * Include the post format-specific template for the content. If you want to * this in a child theme then include a file called called content-___.php * (where ___ is the post format) and that will be used instead. */ get_template_part( 'content', get_post_format() ); endwhile; twentytwelve_content_nav( 'nav-below' ); ?> <?php else : ?> <?php get_template_part( 'content', 'none' ); ?> <?php endif; ?> </div><!-- #content --> </section><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/tag.php
PHP
gpl3
1,404
<?php /** * The template for displaying posts in the Status post format * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="entry-header"> <header> <h1><?php the_author(); ?></h1> <h2><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php echo get_the_date(); ?></a></h2> </header> <?php /** * Filter the status avatar size. * * @since Twenty Twelve 1.0 * * @param int $size The height and width of the avatar in pixels. */ $status_avatar = apply_filters( 'twentytwelve_status_avatar', 48 ); echo get_avatar( get_the_author_meta( 'ID' ), $status_avatar ); ?> </div><!-- .entry-header --> <div class="entry-content"> <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?> </div><!-- .entry-content --> <footer class="entry-meta"> <?php if ( comments_open() ) : ?> <div class="comments-link"> <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?> </div><!-- .comments-link --> <?php endif; // comments_open() ?> <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?> </footer><!-- .entry-meta --> </article><!-- #post -->
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/content-status.php
PHP
gpl3
1,562
<?php /** * Template Name: Full-width Page Template, No Sidebar * * Description: Twenty Twelve loves the no-sidebar look as much as * you do. Use this page template to remove the sidebar from any page. * * Tip: to remove the sidebar from all posts and pages simply remove * any active widgets from the Main Sidebar area, and the sidebar will * disappear everywhere. * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ get_header(); ?> <div id="primary" class="site-content"> <div id="content" role="main"> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', 'page' ); ?> <?php comments_template( '', true ); ?> <?php endwhile; // end of the loop. ?> </div><!-- #content --> </div><!-- #primary --> <?php get_footer(); ?>
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/page-templates/full-width.php
PHP
gpl3
817
<?php /** * Template Name: Front Page Template * * Description: A page template that provides a key component of WordPress as a CMS * by meeting the need for a carefully crafted introductory page. The front page template * in Twenty Twelve consists of a page content area for adding text, images, video -- * anything you'd like -- followed by front-page-only widgets in one or two columns. * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ get_header(); ?> <div id="primary" class="site-content"> <div id="content" role="main"> <?php while ( have_posts() ) : the_post(); ?> <?php if ( has_post_thumbnail() ) : ?> <div class="entry-page-image"> <?php the_post_thumbnail(); ?> </div><!-- .entry-page-image --> <?php endif; ?> <?php get_template_part( 'content', 'page' ); ?> <?php endwhile; // end of the loop. ?> </div><!-- #content --> </div><!-- #primary --> <?php get_sidebar( 'front' ); ?> <?php get_footer(); ?>
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/page-templates/front-page.php
PHP
gpl3
1,004
/* Theme Name: Twenty Twelve Description: Adds support for languages written in a Right To Left (RTL) direction. It's easy, just a matter of overwriting all the horizontal positioning attributes of your CSS stylesheet in a separate stylesheet file named rtl.css. See http://codex.wordpress.org/Right_to_Left_Language_Support */ body { direction: rtl; unicode-bidi: embed; } caption, th, td { text-align: right; } /* =Repeatable patterns -------------------------------------------------------------- */ /* Images */ .site-content .gallery-columns-4 .gallery-item { padding-left: 2%; padding-right: 0; } .site-content .gallery-columns-5 .gallery-item { padding-left: 2%; padding-right: 0; } /* Navigation */ .nav-previous, .previous-image { float: right; } .nav-next, .next-image { float: left; text-align: left; } /* Author profiles */ .author-avatar { float: right; } .author-description { float: right; margin-right: 15px; margin-right: 1.071428571rem; margin-left: auto; } /* =Main Content ----------------------------------------------- */ .comment-content ol, .comment-content ul { margin: 0 24px 0 0; margin: 0 1.714285714rem 0 0; } /* =Basic post styling -------------------------------------------------------------- */ .entry-content li, .comment-content li { margin: 0 24px 0 0; margin: 0 1.714285714rem 0 0; } .entry-content td, .comment-content td { padding: 6px 0 6px 10px; } /* Aside posts */ article.format-aside .aside { border-right: 22px solid #a8bfe8; border-left: none; } /* Link posts */ article.format-link header { float: left; } article.format-link .entry-content { float: right; } /* Status posts */ .format-status .entry-header img { float: right; margin-left: 21px; margin-left: 1.5rem; margin-right: 0; } /* =Comment styling -------------------------------------------------------------- */ .comments-area article header img { float: right; } .comments-area article header cite, .comments-area article header time { margin-right: 85px; margin-right: 6.071428571rem; margin-left: auto; } .comments-area article header h4 { left: 0; right: auto; } .comments-area .bypostauthor cite span { margin-right: 5px; margin-right: 0.357142857rem; margin-left: auto; } /* Comment form */ #respond h3#reply-title #cancel-comment-reply-link { margin-right: 10px; margin-right: 0.714285714rem; margin-left: auto; } label ~ span.required { float: right; margin: -18px -16px 0 0; margin: -1.285714286rem -1.142857143rem 0 0; } /* =Front page template styling -------------------------------------------------------------- */ .template-front-page .widget-area .widget_text img { float: right; margin: 8px 0 8px 24px; margin: 0.571428571rem 0 0.571428571rem 1.714285714rem; } /* =Widget styling -------------------------------------------------------------- */ .widget-area .widget ul ul { margin-right: 12px; margin-right: 0.857142857rem; margin-left: auto; } .widget-area .textwidget li { margin-left: auto; margin-right: 36px; margin-right: 2.571428571rem; } .widget_recent_entries .post-date, .widget_rss .rss-date { margin-right: 12px; margin-right: 0.857142857rem; margin-left: auto; } #wp-calendar th, #wp-calendar td, #wp-calendar caption { text-align: right; } #wp-calendar #next { padding-left: 24px; padding-left: 1.714285714rem; text-align: left; padding-right: 0; } /* =Media queries -------------------------------------------------------------- */ /* Minimum width of 600 pixels. */ @media screen and (min-width: 600px) { .site-content, .template-front-page.has-post-thumbnail article { float: right; } .widget-area, .entry-page-image { float: left; } .site-header h1, .site-header h2 { text-align: right; } .template-front-page .widget-area .widget_text img { float: right; margin: 8px 0 8px 24px; } .template-front-page .widget-area .widget, .template-front-page.two-sidebars .widget-area .front-widgets { float: right; } .template-front-page .widget-area .widget:nth-child(odd) { clear: left; } .template-front-page .widget-area .widget:nth-child(even), .template-front-page.two-sidebars .widget-area .front-widgets + .front-widgets { float: left; margin: 0 24px 0; margin: 0 1.714285714rem 0; } .main-navigation ul.nav-menu, .main-navigation div.nav-menu > ul { text-align: right; } .main-navigation li { margin-left: 40px; margin-left: 2.857142857rem; margin-right: auto; } .main-navigation li ul ul { margin-right: 0; right: 100%; left: auto; } .main-navigation ul li:hover > ul { border-right: 0; border-left: none; } .commentlist .children { margin-right: 48px; margin-right: 3.428571429rem; margin-left: auto; } }
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/rtl.css
CSS
gpl3
4,710
/* Theme Name: Twenty Twelve Description: Used to style the TinyMCE editor for RTL languages. See also rtl.css file. */ html .mceContentBody { direction: rtl; unicode-bidi: embed; } li { margin: 0 24px 0 0; margin: 0 1.714285714rem 0 0; } dl { margin: 0 24px; margin: 0 1.714285714rem; } tr th { text-align: right; } td { padding: 6px 0 6px 10px; text-align: right; } .wp-caption { text-align: right; }
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/editor-style-rtl.css
CSS
gpl3
413
<?php /** * The template for displaying posts in the Image post format * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="entry-content"> <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?> </div><!-- .entry-content --> <footer class="entry-meta"> <a href="<?php the_permalink(); ?>" rel="bookmark"> <h1><?php the_title(); ?></h1> <h2><time class="entry-date" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo get_the_date(); ?></time></h2> </a> <?php if ( comments_open() ) : ?> <div class="comments-link"> <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?> </div><!-- .comments-link --> <?php endif; // comments_open() ?> <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?> </footer><!-- .entry-meta --> </article><!-- #post -->
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/content-image.php
PHP
gpl3
1,137
<?php /** * The template for displaying Author Archive pages * * Used to display archive-type pages for posts by an author. * * @link http://codex.wordpress.org/Template_Hierarchy * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ get_header(); ?> <section id="primary" class="site-content"> <div id="content" role="main"> <?php if ( have_posts() ) : ?> <?php /* Queue the first post, that way we know * what author we're dealing with (if that is the case). * * We reset this later so we can run the loop * properly with a call to rewind_posts(). */ the_post(); ?> <header class="archive-header"> <h1 class="archive-title"><?php printf( __( 'Author Archives: %s', 'twentytwelve' ), '<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' ); ?></h1> </header><!-- .archive-header --> <?php /* Since we called the_post() above, we need to * rewind the loop back to the beginning that way * we can run the loop properly, in full. */ rewind_posts(); ?> <?php twentytwelve_content_nav( 'nav-above' ); ?> <?php // If a user has filled out their description, show a bio on their entries. if ( get_the_author_meta( 'description' ) ) : ?> <div class="author-info"> <div class="author-avatar"> <?php /** * Filter the author bio avatar size. * * @since Twenty Twelve 1.0 * * @param int $size The height and width of the avatar in pixels. */ $author_bio_avatar_size = apply_filters( 'twentytwelve_author_bio_avatar_size', 68 ); echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size ); ?> </div><!-- .author-avatar --> <div class="author-description"> <h2><?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?></h2> <p><?php the_author_meta( 'description' ); ?></p> </div><!-- .author-description --> </div><!-- .author-info --> <?php endif; ?> <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', get_post_format() ); ?> <?php endwhile; ?> <?php twentytwelve_content_nav( 'nav-below' ); ?> <?php else : ?> <?php get_template_part( 'content', 'none' ); ?> <?php endif; ?> </div><!-- #content --> </section><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/author.php
PHP
gpl3
2,580
<?php /** * The template for displaying the footer * * Contains footer content and the closing of the #main and #page div elements. * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ ?> </div><!-- #main .wrapper --> <footer id="colophon" role="contentinfo"> <div class="site-info"> <?php do_action( 'twentytwelve_credits' ); ?> <a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentytwelve' ) ); ?>" title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'twentytwelve' ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentytwelve' ), 'WordPress' ); ?></a> </div><!-- .site-info --> </footer><!-- #colophon --> </div><!-- #page --> <?php wp_footer(); ?> </body> </html>
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/footer.php
PHP
gpl3
745
<?php /** * The template for displaying Archive pages * * Used to display archive-type pages if nothing more specific matches a query. * For example, puts together date-based pages if no date.php file exists. * * If you'd like to further customize these archive views, you may create a * new template file for each specific one. For example, Twenty Twelve already * has tag.php for Tag archives, category.php for Category archives, and * author.php for Author archives. * * @link http://codex.wordpress.org/Template_Hierarchy * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ get_header(); ?> <section id="primary" class="site-content"> <div id="content" role="main"> <?php if ( have_posts() ) : ?> <header class="archive-header"> <h1 class="archive-title"><?php if ( is_day() ) : printf( __( 'Daily Archives: %s', 'twentytwelve' ), '<span>' . get_the_date() . '</span>' ); elseif ( is_month() ) : printf( __( 'Monthly Archives: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentytwelve' ) ) . '</span>' ); elseif ( is_year() ) : printf( __( 'Yearly Archives: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentytwelve' ) ) . '</span>' ); else : _e( 'Archives', 'twentytwelve' ); endif; ?></h1> </header><!-- .archive-header --> <?php /* Start the Loop */ while ( have_posts() ) : the_post(); /* Include the post format-specific template for the content. If you want to * this in a child theme then include a file called called content-___.php * (where ___ is the post format) and that will be used instead. */ get_template_part( 'content', get_post_format() ); endwhile; twentytwelve_content_nav( 'nav-below' ); ?> <?php else : ?> <?php get_template_part( 'content', 'none' ); ?> <?php endif; ?> </div><!-- #content --> </section><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/archive.php
PHP
gpl3
2,061
<?php /** * The template for displaying Category pages * * Used to display archive-type pages for posts in a category. * * @link http://codex.wordpress.org/Template_Hierarchy * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ get_header(); ?> <section id="primary" class="site-content"> <div id="content" role="main"> <?php if ( have_posts() ) : ?> <header class="archive-header"> <h1 class="archive-title"><?php printf( __( 'Category Archives: %s', 'twentytwelve' ), '<span>' . single_cat_title( '', false ) . '</span>' ); ?></h1> <?php if ( category_description() ) : // Show an optional category description ?> <div class="archive-meta"><?php echo category_description(); ?></div> <?php endif; ?> </header><!-- .archive-header --> <?php /* Start the Loop */ while ( have_posts() ) : the_post(); /* Include the post format-specific template for the content. If you want to * this in a child theme then include a file called called content-___.php * (where ___ is the post format) and that will be used instead. */ get_template_part( 'content', get_post_format() ); endwhile; twentytwelve_content_nav( 'nav-below' ); ?> <?php else : ?> <?php get_template_part( 'content', 'none' ); ?> <?php endif; ?> </div><!-- #content --> </section><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/category.php
PHP
gpl3
1,427
<?php /** * The default template for displaying content * * Used for both single and index/archive/search. * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php if ( is_sticky() && is_home() && ! is_paged() ) : ?> <div class="featured-post"> <?php _e( 'Featured post', 'twentytwelve' ); ?> </div> <?php endif; ?> <header class="entry-header"> <?php if ( ! post_password_required() && ! is_attachment() ) : the_post_thumbnail(); endif; ?> <?php if ( is_single() ) : ?> <h1 class="entry-title"><?php the_title(); ?></h1> <?php else : ?> <h1 class="entry-title"> <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> </h1> <?php endif; // is_single() ?> <?php if ( comments_open() ) : ?> <div class="comments-link"> <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?> </div><!-- .comments-link --> <?php endif; // comments_open() ?> </header><!-- .entry-header --> <?php if ( is_search() ) : // Only display Excerpts for Search ?> <div class="entry-summary"> <?php the_excerpt(); ?> </div><!-- .entry-summary --> <?php else : ?> <div class="entry-content"> <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?> </div><!-- .entry-content --> <?php endif; ?> <footer class="entry-meta"> <?php twentytwelve_entry_meta(); ?> <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?> <?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?> <div class="author-info"> <div class="author-avatar"> <?php /** This filter is documented in author.php */ $author_bio_avatar_size = apply_filters( 'twentytwelve_author_bio_avatar_size', 68 ); echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size ); ?> </div><!-- .author-avatar --> <div class="author-description"> <h2><?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?></h2> <p><?php the_author_meta( 'description' ); ?></p> <div class="author-link"> <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author"> <?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentytwelve' ), get_the_author() ); ?> </a> </div><!-- .author-link --> </div><!-- .author-description --> </div><!-- .author-info --> <?php endif; ?> </footer><!-- .entry-meta --> </article><!-- #post -->
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/content.php
PHP
gpl3
3,052
/* Theme Name: Twenty Twelve Theme URI: http://wordpress.org/themes/twentytwelve Author: the WordPress team Author URI: http://wordpress.org/ Description: The 2012 theme for WordPress is a fully responsive theme that looks great on any device. Features include a front page template with its own widgets, an optional display font, styling for post formats on both index and single views, and an optional no-sidebar page template. Make it yours with a custom menu, header image, and background. Version: 1.3 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Tags: light, gray, white, one-column, two-columns, right-sidebar, fluid-layout, responsive-layout, custom-background, custom-header, custom-menu, editor-style, featured-images, flexible-header, full-width-template, microformats, post-formats, rtl-language-support, sticky-post, theme-options, translation-ready Text Domain: twentytwelve This theme, like WordPress, is licensed under the GPL. Use it to make something cool, have fun, and share what you've learned with others. */ /* =Notes -------------------------------------------------------------- This stylesheet uses rem values with a pixel fallback. The rem values (and line heights) are calculated using two variables: $rembase: 14; $line-height: 24; ---------- Examples * Use a pixel value with a rem fallback for font-size, padding, margins, etc. padding: 5px 0; padding: 0.357142857rem 0; (5 / $rembase) * Set a font-size and then set a line-height based on the font-size font-size: 16px font-size: 1.142857143rem; (16 / $rembase) line-height: 1.5; ($line-height / 16) ---------- Vertical spacing Vertical spacing between most elements should use 24px or 48px to maintain vertical rhythm: .my-new-div { margin: 24px 0; margin: 1.714285714rem 0; ( 24 / $rembase ) } ---------- Further reading http://snook.ca/archives/html_and_css/font-size-with-rem http://blog.typekit.com/2011/11/09/type-study-sizing-the-legible-letter/ /* =Reset -------------------------------------------------------------- */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; vertical-align: baseline; } body { line-height: 1; } ol, ul { list-style: none; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; } table { border-collapse: collapse; border-spacing: 0; } caption, th, td { font-weight: normal; text-align: left; } h1, h2, h3, h4, h5, h6 { clear: both; } html { overflow-y: scroll; font-size: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } a:focus { outline: thin dotted; } article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; } audio, canvas, video { display: inline-block; } audio:not([controls]) { display: none; } del { color: #333; } ins { background: #fff9c0; text-decoration: none; } hr { background-color: #ccc; border: 0; height: 1px; margin: 24px; margin-bottom: 1.714285714rem; } sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } sup { top: -0.5em; } sub { bottom: -0.25em; } small { font-size: smaller; } img { border: 0; -ms-interpolation-mode: bicubic; } /* Clearing floats */ .clear:after, .wrapper:after, .format-status .entry-header:after { clear: both; } .clear:before, .clear:after, .wrapper:before, .wrapper:after, .format-status .entry-header:before, .format-status .entry-header:after { display: table; content: ""; } /* =Repeatable patterns -------------------------------------------------------------- */ /* Small headers */ .archive-title, .page-title, .widget-title, .entry-content th, .comment-content th { font-size: 11px; font-size: 0.785714286rem; line-height: 2.181818182; font-weight: bold; text-transform: uppercase; color: #636363; } /* Shared Post Format styling */ article.format-quote footer.entry-meta, article.format-link footer.entry-meta, article.format-status footer.entry-meta { font-size: 11px; font-size: 0.785714286rem; line-height: 2.181818182; } /* Form fields, general styles first */ button, input, select, textarea { border: 1px solid #ccc; border-radius: 3px; font-family: inherit; padding: 6px; padding: 0.428571429rem; } button, input { line-height: normal; } textarea { font-size: 100%; overflow: auto; vertical-align: top; } /* Reset non-text input types */ input[type="checkbox"], input[type="radio"], input[type="file"], input[type="hidden"], input[type="image"], input[type="color"] { border: 0; border-radius: 0; padding: 0; } /* Buttons */ .menu-toggle, input[type="submit"], input[type="button"], input[type="reset"], article.post-password-required input[type=submit], .bypostauthor cite span { padding: 6px 10px; padding: 0.428571429rem 0.714285714rem; font-size: 11px; font-size: 0.785714286rem; line-height: 1.428571429; font-weight: normal; color: #7c7c7c; background-color: #e6e6e6; background-repeat: repeat-x; background-image: -moz-linear-gradient(top, #f4f4f4, #e6e6e6); background-image: -ms-linear-gradient(top, #f4f4f4, #e6e6e6); background-image: -webkit-linear-gradient(top, #f4f4f4, #e6e6e6); background-image: -o-linear-gradient(top, #f4f4f4, #e6e6e6); background-image: linear-gradient(top, #f4f4f4, #e6e6e6); border: 1px solid #d2d2d2; border-radius: 3px; box-shadow: 0 1px 2px rgba(64, 64, 64, 0.1); } .menu-toggle, button, input[type="submit"], input[type="button"], input[type="reset"] { cursor: pointer; } button[disabled], input[disabled] { cursor: default; } .menu-toggle:hover, button:hover, input[type="submit"]:hover, input[type="button"]:hover, input[type="reset"]:hover, article.post-password-required input[type=submit]:hover { color: #5e5e5e; background-color: #ebebeb; background-repeat: repeat-x; background-image: -moz-linear-gradient(top, #f9f9f9, #ebebeb); background-image: -ms-linear-gradient(top, #f9f9f9, #ebebeb); background-image: -webkit-linear-gradient(top, #f9f9f9, #ebebeb); background-image: -o-linear-gradient(top, #f9f9f9, #ebebeb); background-image: linear-gradient(top, #f9f9f9, #ebebeb); } .menu-toggle:active, .menu-toggle.toggled-on, button:active, input[type="submit"]:active, input[type="button"]:active, input[type="reset"]:active { color: #757575; background-color: #e1e1e1; background-repeat: repeat-x; background-image: -moz-linear-gradient(top, #ebebeb, #e1e1e1); background-image: -ms-linear-gradient(top, #ebebeb, #e1e1e1); background-image: -webkit-linear-gradient(top, #ebebeb, #e1e1e1); background-image: -o-linear-gradient(top, #ebebeb, #e1e1e1); background-image: linear-gradient(top, #ebebeb, #e1e1e1); box-shadow: inset 0 0 8px 2px #c6c6c6, 0 1px 0 0 #f4f4f4; border-color: transparent; } .bypostauthor cite span { color: #fff; background-color: #21759b; background-image: none; border: 1px solid #1f6f93; border-radius: 2px; box-shadow: none; padding: 0; } /* Responsive images */ .entry-content img, .comment-content img, .widget img { max-width: 100%; /* Fluid images for posts, comments, and widgets */ } img[class*="align"], img[class*="wp-image-"], img[class*="attachment-"] { height: auto; /* Make sure images with WordPress-added height and width attributes are scaled correctly */ } img.size-full, img.size-large, img.header-image, img.wp-post-image { max-width: 100%; height: auto; /* Make sure images with WordPress-added height and width attributes are scaled correctly */ } /* Make sure videos and embeds fit their containers */ embed, iframe, object, video { max-width: 100%; } .entry-content .twitter-tweet-rendered { max-width: 100% !important; /* Override the Twitter embed fixed width */ } /* Images */ .alignleft { float: left; } .alignright { float: right; } .aligncenter { display: block; margin-left: auto; margin-right: auto; } .entry-content img, .comment-content img, .widget img, img.header-image, .author-avatar img, img.wp-post-image { /* Add fancy borders to all WordPress-added images but not things like badges and icons and the like */ border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); } .wp-caption { max-width: 100%; /* Keep wide captions from overflowing their container. */ padding: 4px; } .wp-caption .wp-caption-text, .gallery-caption, .entry-caption { font-style: italic; font-size: 12px; font-size: 0.857142857rem; line-height: 2; color: #757575; } img.wp-smiley, .rsswidget img { border: 0; border-radius: 0; box-shadow: none; margin-bottom: 0; margin-top: 0; padding: 0; } .entry-content dl.gallery-item { margin: 0; } .gallery-item a, .gallery-caption { width: 90%; } .gallery-item a { display: block; } .gallery-caption a { display: inline; } .gallery-columns-1 .gallery-item a { max-width: 100%; width: auto; } .gallery .gallery-icon img { height: auto; max-width: 90%; padding: 5%; } .gallery-columns-1 .gallery-icon img { padding: 3%; } /* Navigation */ .site-content nav { clear: both; line-height: 2; overflow: hidden; } #nav-above { padding: 24px 0; padding: 1.714285714rem 0; } #nav-above { display: none; } .paged #nav-above { display: block; } .nav-previous, .previous-image { float: left; width: 50%; } .nav-next, .next-image { float: right; text-align: right; width: 50%; } .nav-single + .comments-area, #comment-nav-above { margin: 48px 0; margin: 3.428571429rem 0; } /* Author profiles */ .author .archive-header { margin-bottom: 24px; margin-bottom: 1.714285714rem; } .author-info { border-top: 1px solid #ededed; margin: 24px 0; margin: 1.714285714rem 0; padding-top: 24px; padding-top: 1.714285714rem; overflow: hidden; } .author-description p { color: #757575; font-size: 13px; font-size: 0.928571429rem; line-height: 1.846153846; } .author.archive .author-info { border-top: 0; margin: 0 0 48px; margin: 0 0 3.428571429rem; } .author.archive .author-avatar { margin-top: 0; } /* =Basic structure -------------------------------------------------------------- */ /* Body, links, basics */ html { font-size: 87.5%; } body { font-size: 14px; font-size: 1rem; font-family: Helvetica, Arial, sans-serif; text-rendering: optimizeLegibility; color: #444; } body.custom-font-enabled { font-family: "Open Sans", Helvetica, Arial, sans-serif; } a { outline: none; color: #21759b; } a:hover { color: #0f3647; } /* Assistive text */ .assistive-text, .site .screen-reader-text { position: absolute !important; clip: rect(1px, 1px, 1px, 1px); } .main-navigation .assistive-text:focus { background: #fff; border: 2px solid #333; border-radius: 3px; clip: auto !important; color: #000; display: block; font-size: 12px; padding: 12px; position: absolute; top: 5px; left: 5px; z-index: 100000; /* Above WP toolbar */ } /* Page structure */ .site { padding: 0 24px; padding: 0 1.714285714rem; background-color: #fff; } .site-content { margin: 24px 0 0; margin: 1.714285714rem 0 0; } .widget-area { margin: 24px 0 0; margin: 1.714285714rem 0 0; } /* Header */ .site-header { padding: 24px 0; padding: 1.714285714rem 0; } .site-header h1, .site-header h2 { text-align: center; } .site-header h1 a, .site-header h2 a { color: #515151; display: inline-block; text-decoration: none; } .site-header h1 a:hover, .site-header h2 a:hover { color: #21759b; } .site-header h1 { font-size: 24px; font-size: 1.714285714rem; line-height: 1.285714286; margin-bottom: 14px; margin-bottom: 1rem; } .site-header h2 { font-weight: normal; font-size: 13px; font-size: 0.928571429rem; line-height: 1.846153846; color: #757575; } .header-image { margin-top: 24px; margin-top: 1.714285714rem; } /* Navigation Menu */ .main-navigation { margin-top: 24px; margin-top: 1.714285714rem; text-align: center; } .main-navigation li { margin-top: 24px; margin-top: 1.714285714rem; font-size: 12px; font-size: 0.857142857rem; line-height: 1.42857143; } .main-navigation a { color: #5e5e5e; } .main-navigation a:hover, .main-navigation a:focus { color: #21759b; } .main-navigation ul.nav-menu, .main-navigation div.nav-menu > ul { display: none; } .main-navigation ul.nav-menu.toggled-on, .menu-toggle { display: inline-block; } /* Banner */ section[role="banner"] { margin-bottom: 48px; margin-bottom: 3.428571429rem; } /* Sidebar */ .widget-area .widget { -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; margin-bottom: 48px; margin-bottom: 3.428571429rem; word-wrap: break-word; } .widget-area .widget h3 { margin-bottom: 24px; margin-bottom: 1.714285714rem; } .widget-area .widget p, .widget-area .widget li, .widget-area .widget .textwidget { font-size: 13px; font-size: 0.928571429rem; line-height: 1.846153846; } .widget-area .widget p { margin-bottom: 24px; margin-bottom: 1.714285714rem; } .widget-area .textwidget ul { list-style: disc outside; margin: 0 0 24px; margin: 0 0 1.714285714rem; } .widget-area .textwidget li { margin-left: 36px; margin-left: 2.571428571rem; } .widget-area .widget a { color: #757575; } .widget-area .widget a:hover { color: #21759b; } .widget-area .widget a:visited { color: #9f9f9f; } .widget-area #s { width: 53.66666666666%; /* define a width to avoid dropping a wider submit button */ } /* Footer */ footer[role="contentinfo"] { border-top: 1px solid #ededed; clear: both; font-size: 12px; font-size: 0.857142857rem; line-height: 2; max-width: 960px; max-width: 68.571428571rem; margin-top: 24px; margin-top: 1.714285714rem; margin-left: auto; margin-right: auto; padding: 24px 0; padding: 1.714285714rem 0; } footer[role="contentinfo"] a { color: #686868; } footer[role="contentinfo"] a:hover { color: #21759b; } /* =Main content and comment content -------------------------------------------------------------- */ .entry-meta { clear: both; } .entry-header { margin-bottom: 24px; margin-bottom: 1.714285714rem; } .entry-header img.wp-post-image { margin-bottom: 24px; margin-bottom: 1.714285714rem; } .entry-header .entry-title { font-size: 20px; font-size: 1.428571429rem; line-height: 1.2; font-weight: normal; } .entry-header .entry-title a { text-decoration: none; } .entry-header .entry-format { margin-top: 24px; margin-top: 1.714285714rem; font-weight: normal; } .entry-header .comments-link { margin-top: 24px; margin-top: 1.714285714rem; font-size: 13px; font-size: 0.928571429rem; line-height: 1.846153846; color: #757575; } .comments-link a, .entry-meta a { color: #757575; } .comments-link a:hover, .entry-meta a:hover { color: #21759b; } article.sticky .featured-post { border-top: 4px double #ededed; border-bottom: 4px double #ededed; color: #757575; font-size: 13px; font-size: 0.928571429rem; line-height: 3.692307692; margin-bottom: 24px; margin-bottom: 1.714285714rem; text-align: center; } .entry-content, .entry-summary, .mu_register { line-height: 1.714285714; } .entry-content h1, .comment-content h1, .entry-content h2, .comment-content h2, .entry-content h3, .comment-content h3, .entry-content h4, .comment-content h4, .entry-content h5, .comment-content h5, .entry-content h6, .comment-content h6 { margin: 24px 0; margin: 1.714285714rem 0; line-height: 1.714285714; } .entry-content h1, .comment-content h1 { font-size: 21px; font-size: 1.5rem; line-height: 1.5; } .entry-content h2, .comment-content h2, .mu_register h2 { font-size: 18px; font-size: 1.285714286rem; line-height: 1.6; } .entry-content h3, .comment-content h3 { font-size: 16px; font-size: 1.142857143rem; line-height: 1.846153846; } .entry-content h4, .comment-content h4 { font-size: 14px; font-size: 1rem; line-height: 1.846153846; } .entry-content h5, .comment-content h5 { font-size: 13px; font-size: 0.928571429rem; line-height: 1.846153846; } .entry-content h6, .comment-content h6 { font-size: 12px; font-size: 0.857142857rem; line-height: 1.846153846; } .entry-content p, .entry-summary p, .comment-content p, .mu_register p { margin: 0 0 24px; margin: 0 0 1.714285714rem; line-height: 1.714285714; } .entry-content a:visited, .comment-content a:visited { color: #9f9f9f; } .entry-content ol, .comment-content ol, .entry-content ul, .comment-content ul, .mu_register ul { margin: 0 0 24px; margin: 0 0 1.714285714rem; line-height: 1.714285714; } .entry-content ul ul, .comment-content ul ul, .entry-content ol ol, .comment-content ol ol, .entry-content ul ol, .comment-content ul ol, .entry-content ol ul, .comment-content ol ul { margin-bottom: 0; } .entry-content ul, .comment-content ul, .mu_register ul { list-style: disc outside; } .entry-content ol, .comment-content ol { list-style: decimal outside; } .entry-content li, .comment-content li, .mu_register li { margin: 0 0 0 36px; margin: 0 0 0 2.571428571rem; } .entry-content blockquote, .comment-content blockquote { margin-bottom: 24px; margin-bottom: 1.714285714rem; padding: 24px; padding: 1.714285714rem; font-style: italic; } .entry-content blockquote p:last-child, .comment-content blockquote p:last-child { margin-bottom: 0; } .entry-content code, .comment-content code { font-family: Consolas, Monaco, Lucida Console, monospace; font-size: 12px; font-size: 0.857142857rem; line-height: 2; } .entry-content pre, .comment-content pre { border: 1px solid #ededed; color: #666; font-family: Consolas, Monaco, Lucida Console, monospace; font-size: 12px; font-size: 0.857142857rem; line-height: 1.714285714; margin: 24px 0; margin: 1.714285714rem 0; overflow: auto; padding: 24px; padding: 1.714285714rem; } .entry-content pre code, .comment-content pre code { display: block; } .entry-content abbr, .comment-content abbr, .entry-content dfn, .comment-content dfn, .entry-content acronym, .comment-content acronym { border-bottom: 1px dotted #666; cursor: help; } .entry-content address, .comment-content address { display: block; line-height: 1.714285714; margin: 0 0 24px; margin: 0 0 1.714285714rem; } img.alignleft, .wp-caption.alignleft { margin: 12px 24px 12px 0; margin: 0.857142857rem 1.714285714rem 0.857142857rem 0; } img.alignright, .wp-caption.alignright { margin: 12px 0 12px 24px; margin: 0.857142857rem 0 0.857142857rem 1.714285714rem; } img.aligncenter, .wp-caption.aligncenter { clear: both; margin-top: 12px; margin-top: 0.857142857rem; margin-bottom: 12px; margin-bottom: 0.857142857rem; } .entry-content embed, .entry-content iframe, .entry-content object, .entry-content video { margin-bottom: 24px; margin-bottom: 1.714285714rem; } .entry-content dl, .comment-content dl { margin: 0 24px; margin: 0 1.714285714rem; } .entry-content dt, .comment-content dt { font-weight: bold; line-height: 1.714285714; } .entry-content dd, .comment-content dd { line-height: 1.714285714; margin-bottom: 24px; margin-bottom: 1.714285714rem; } .entry-content table, .comment-content table { border-bottom: 1px solid #ededed; color: #757575; font-size: 12px; font-size: 0.857142857rem; line-height: 2; margin: 0 0 24px; margin: 0 0 1.714285714rem; width: 100%; } .entry-content table caption, .comment-content table caption { font-size: 16px; font-size: 1.142857143rem; margin: 24px 0; margin: 1.714285714rem 0; } .entry-content td, .comment-content td { border-top: 1px solid #ededed; padding: 6px 10px 6px 0; } .site-content article { border-bottom: 4px double #ededed; margin-bottom: 72px; margin-bottom: 5.142857143rem; padding-bottom: 24px; padding-bottom: 1.714285714rem; word-wrap: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; } .page-links { clear: both; line-height: 1.714285714; } footer.entry-meta { margin-top: 24px; margin-top: 1.714285714rem; font-size: 13px; font-size: 0.928571429rem; line-height: 1.846153846; color: #757575; } .single-author .entry-meta .by-author { display: none; } .mu_register h2 { color: #757575; font-weight: normal; } /* =Archives -------------------------------------------------------------- */ .archive-header, .page-header { margin-bottom: 48px; margin-bottom: 3.428571429rem; padding-bottom: 22px; padding-bottom: 1.571428571rem; border-bottom: 1px solid #ededed; } .archive-meta { color: #757575; font-size: 12px; font-size: 0.857142857rem; line-height: 2; margin-top: 22px; margin-top: 1.571428571rem; } /* =Single audio/video attachment view -------------------------------------------------------------- */ .attachment .entry-content .mejs-audio { max-width: 400px; } .attachment .entry-content .mejs-container { margin-bottom: 24px; } /* =Single image attachment view -------------------------------------------------------------- */ .article.attachment { overflow: hidden; } .image-attachment div.attachment { text-align: center; } .image-attachment div.attachment p { text-align: center; } .image-attachment div.attachment img { display: block; height: auto; margin: 0 auto; max-width: 100%; } .image-attachment .entry-caption { margin-top: 8px; margin-top: 0.571428571rem; } /* =Aside post format -------------------------------------------------------------- */ article.format-aside h1 { margin-bottom: 24px; margin-bottom: 1.714285714rem; } article.format-aside h1 a { text-decoration: none; color: #4d525a; } article.format-aside h1 a:hover { color: #2e3542; } article.format-aside .aside { padding: 24px 24px 0; padding: 1.714285714rem; background: #d2e0f9; border-left: 22px solid #a8bfe8; } article.format-aside p { font-size: 13px; font-size: 0.928571429rem; line-height: 1.846153846; color: #4a5466; } article.format-aside blockquote:last-child, article.format-aside p:last-child { margin-bottom: 0; } /* =Post formats -------------------------------------------------------------- */ /* Image posts */ article.format-image footer h1 { font-size: 13px; font-size: 0.928571429rem; line-height: 1.846153846; font-weight: normal; } article.format-image footer h2 { font-size: 11px; font-size: 0.785714286rem; line-height: 2.181818182; } article.format-image footer a h2 { font-weight: normal; } /* Link posts */ article.format-link header { padding: 0 10px; padding: 0 0.714285714rem; float: right; font-size: 11px; font-size: 0.785714286rem; line-height: 2.181818182; font-weight: bold; font-style: italic; text-transform: uppercase; color: #848484; background-color: #ebebeb; border-radius: 3px; } article.format-link .entry-content { max-width: 80%; float: left; } article.format-link .entry-content a { font-size: 22px; font-size: 1.571428571rem; line-height: 1.090909091; text-decoration: none; } /* Quote posts */ article.format-quote .entry-content p { margin: 0; padding-bottom: 24px; padding-bottom: 1.714285714rem; } article.format-quote .entry-content blockquote { display: block; padding: 24px 24px 0; padding: 1.714285714rem 1.714285714rem 0; font-size: 15px; font-size: 1.071428571rem; line-height: 1.6; font-style: normal; color: #6a6a6a; background: #efefef; } /* Status posts */ .format-status .entry-header { margin-bottom: 24px; margin-bottom: 1.714285714rem; } .format-status .entry-header header { display: inline-block; } .format-status .entry-header h1 { font-size: 15px; font-size: 1.071428571rem; font-weight: normal; line-height: 1.6; margin: 0; } .format-status .entry-header h2 { font-size: 12px; font-size: 0.857142857rem; font-weight: normal; line-height: 2; margin: 0; } .format-status .entry-header header a { color: #757575; } .format-status .entry-header header a:hover { color: #21759b; } .format-status .entry-header img { float: left; margin-right: 21px; margin-right: 1.5rem; } /* =Comments -------------------------------------------------------------- */ .comments-title { margin-bottom: 48px; margin-bottom: 3.428571429rem; font-size: 16px; font-size: 1.142857143rem; line-height: 1.5; font-weight: normal; } .comments-area article { margin: 24px 0; margin: 1.714285714rem 0; } .comments-area article header { margin: 0 0 48px; margin: 0 0 3.428571429rem; overflow: hidden; position: relative; } .comments-area article header img { float: left; padding: 0; line-height: 0; } .comments-area article header cite, .comments-area article header time { display: block; margin-left: 85px; margin-left: 6.071428571rem; } .comments-area article header cite { font-style: normal; font-size: 15px; font-size: 1.071428571rem; line-height: 1.42857143; } .comments-area cite b { font-weight: normal; } .comments-area article header time { line-height: 1.714285714; text-decoration: none; font-size: 12px; font-size: 0.857142857rem; color: #5e5e5e; } .comments-area article header a { text-decoration: none; color: #5e5e5e; } .comments-area article header a:hover { color: #21759b; } .comments-area article header cite a { color: #444; } .comments-area article header cite a:hover { text-decoration: underline; } .comments-area article header h4 { position: absolute; top: 0; right: 0; padding: 6px 12px; padding: 0.428571429rem 0.857142857rem; font-size: 12px; font-size: 0.857142857rem; font-weight: normal; color: #fff; background-color: #0088d0; background-repeat: repeat-x; background-image: -moz-linear-gradient(top, #009cee, #0088d0); background-image: -ms-linear-gradient(top, #009cee, #0088d0); background-image: -webkit-linear-gradient(top, #009cee, #0088d0); background-image: -o-linear-gradient(top, #009cee, #0088d0); background-image: linear-gradient(top, #009cee, #0088d0); border-radius: 3px; border: 1px solid #007cbd; } .comments-area .bypostauthor cite span { position: absolute; margin-left: 5px; margin-left: 0.357142857rem; padding: 2px 5px; padding: 0.142857143rem 0.357142857rem; font-size: 10px; font-size: 0.714285714rem; } .comments-area .bypostauthor cite b { font-weight: bold; } a.comment-reply-link, a.comment-edit-link { color: #686868; font-size: 13px; font-size: 0.928571429rem; line-height: 1.846153846; } a.comment-reply-link:hover, a.comment-edit-link:hover { color: #21759b; } .commentlist .pingback { line-height: 1.714285714; margin-bottom: 24px; margin-bottom: 1.714285714rem; } /* Comment form */ #respond { margin-top: 48px; margin-top: 3.428571429rem; } #respond h3#reply-title { font-size: 16px; font-size: 1.142857143rem; line-height: 1.5; } #respond h3#reply-title #cancel-comment-reply-link { margin-left: 10px; margin-left: 0.714285714rem; font-weight: normal; font-size: 12px; font-size: 0.857142857rem; } #respond form { margin: 24px 0; margin: 1.714285714rem 0; } #respond form p { margin: 11px 0; margin: 0.785714286rem 0; } #respond form p.logged-in-as { margin-bottom: 24px; margin-bottom: 1.714285714rem; } #respond form label { display: block; line-height: 1.714285714; } #respond form input[type="text"], #respond form textarea { -moz-box-sizing: border-box; box-sizing: border-box; font-size: 12px; font-size: 0.857142857rem; line-height: 1.714285714; padding: 10px; padding: 0.714285714rem; width: 100%; } #respond form p.form-allowed-tags { margin: 0; font-size: 12px; font-size: 0.857142857rem; line-height: 2; color: #5e5e5e; } .required { color: red; } /* =Front page template -------------------------------------------------------------- */ .entry-page-image { margin-bottom: 14px; margin-bottom: 1rem; } .template-front-page .site-content article { border: 0; margin-bottom: 0; } .template-front-page .widget-area { clear: both; float: none; width: auto; padding-top: 24px; padding-top: 1.714285714rem; border-top: 1px solid #ededed; } .template-front-page .widget-area .widget li { margin: 8px 0 0; margin: 0.571428571rem 0 0; font-size: 13px; font-size: 0.928571429rem; line-height: 1.714285714; list-style-type: square; list-style-position: inside; } .template-front-page .widget-area .widget li a { color: #757575; } .template-front-page .widget-area .widget li a:hover { color: #21759b; } .template-front-page .widget-area .widget_text img { float: left; margin: 8px 24px 8px 0; margin: 0.571428571rem 1.714285714rem 0.571428571rem 0; } /* =Widgets -------------------------------------------------------------- */ .widget-area .widget ul ul { margin-left: 12px; margin-left: 0.857142857rem; } .widget_rss li { margin: 12px 0; margin: 0.857142857rem 0; } .widget_recent_entries .post-date, .widget_rss .rss-date { color: #aaa; font-size: 11px; font-size: 0.785714286rem; margin-left: 12px; margin-left: 0.857142857rem; } #wp-calendar { margin: 0; width: 100%; font-size: 13px; font-size: 0.928571429rem; line-height: 1.846153846; color: #686868; } #wp-calendar th, #wp-calendar td, #wp-calendar caption { text-align: left; } #wp-calendar #next { padding-right: 24px; padding-right: 1.714285714rem; text-align: right; } .widget_search label { display: block; font-size: 13px; font-size: 0.928571429rem; line-height: 1.846153846; } .widget_twitter li { list-style-type: none; } .widget_twitter .timesince { display: block; text-align: right; } /* =Plugins ----------------------------------------------- */ img#wpstats { display: block; margin: 0 auto 24px; margin: 0 auto 1.714285714rem; } /* =Media queries -------------------------------------------------------------- */ /* Does the same thing as <meta name="viewport" content="width=device-width">, * but in the future W3C standard way. -ms- prefix is required for IE10+ to * render responsive styling in Windows 8 "snapped" views; IE10+ does not honor * the meta tag. See http://core.trac.wordpress.org/ticket/25888. */ @-ms-viewport { width: device-width; } @viewport { width: device-width; } /* Minimum width of 600 pixels. */ @media screen and (min-width: 600px) { .author-avatar { float: left; margin-top: 8px; margin-top: 0.571428571rem; } .author-description { float: right; width: 80%; } .site { margin: 0 auto; max-width: 960px; max-width: 68.571428571rem; overflow: hidden; } .site-content { float: left; width: 65.104166667%; } body.template-front-page .site-content, body.attachment .site-content, body.full-width .site-content { width: 100%; } .widget-area { float: right; width: 26.041666667%; } .site-header h1, .site-header h2 { text-align: left; } .site-header h1 { font-size: 26px; font-size: 1.857142857rem; line-height: 1.846153846; margin-bottom: 0; } .main-navigation ul.nav-menu, .main-navigation div.nav-menu > ul { border-bottom: 1px solid #ededed; border-top: 1px solid #ededed; display: inline-block !important; text-align: left; width: 100%; } .main-navigation ul { margin: 0; text-indent: 0; } .main-navigation li a, .main-navigation li { display: inline-block; text-decoration: none; } .main-navigation li a { border-bottom: 0; color: #6a6a6a; line-height: 3.692307692; text-transform: uppercase; white-space: nowrap; } .main-navigation li a:hover, .main-navigation li a:focus { color: #000; } .main-navigation li { margin: 0 40px 0 0; margin: 0 2.857142857rem 0 0; position: relative; } .main-navigation li ul { margin: 0; padding: 0; position: absolute; top: 100%; z-index: 1; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); } .main-navigation li ul ul { top: 0; left: 100%; } .main-navigation ul li:hover > ul, .main-navigation ul li:focus > ul, .main-navigation .focus > ul { border-left: 0; clip: inherit; overflow: inherit; height: inherit; width: inherit; } .main-navigation li ul li a { background: #efefef; border-bottom: 1px solid #ededed; display: block; font-size: 11px; font-size: 0.785714286rem; line-height: 2.181818182; padding: 8px 10px; padding: 0.571428571rem 0.714285714rem; width: 180px; width: 12.85714286rem; white-space: normal; } .main-navigation li ul li a:hover, .main-navigation li ul li a:focus { background: #e3e3e3; color: #444; } .main-navigation .current-menu-item > a, .main-navigation .current-menu-ancestor > a, .main-navigation .current_page_item > a, .main-navigation .current_page_ancestor > a { color: #636363; font-weight: bold; } .menu-toggle { display: none; } .entry-header .entry-title { font-size: 22px; font-size: 1.571428571rem; } #respond form input[type="text"] { width: 46.333333333%; } #respond form textarea.blog-textarea { width: 79.666666667%; } .template-front-page .site-content, .template-front-page article { overflow: hidden; } .template-front-page.has-post-thumbnail article { float: left; width: 47.916666667%; } .entry-page-image { float: right; margin-bottom: 0; width: 47.916666667%; } .template-front-page .widget-area .widget, .template-front-page.two-sidebars .widget-area .front-widgets { float: left; width: 51.875%; margin-bottom: 24px; margin-bottom: 1.714285714rem; } .template-front-page .widget-area .widget:nth-child(odd) { clear: right; } .template-front-page .widget-area .widget:nth-child(even), .template-front-page.two-sidebars .widget-area .front-widgets + .front-widgets { float: right; width: 39.0625%; margin: 0 0 24px; margin: 0 0 1.714285714rem; } .template-front-page.two-sidebars .widget, .template-front-page.two-sidebars .widget:nth-child(even) { float: none; width: auto; } .commentlist .children { margin-left: 48px; margin-left: 3.428571429rem; } } /* Minimum width of 960 pixels. */ @media screen and (min-width: 960px) { body { background-color: #e6e6e6; } body .site { padding: 0 40px; padding: 0 2.857142857rem; margin-top: 48px; margin-top: 3.428571429rem; margin-bottom: 48px; margin-bottom: 3.428571429rem; box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3); } body.custom-background-empty { background-color: #fff; } body.custom-background-empty .site, body.custom-background-white .site { padding: 0; margin-top: 0; margin-bottom: 0; box-shadow: none; } } /* =Print ----------------------------------------------- */ @media print { body { background: none !important; color: #000; font-size: 10pt; } footer a[rel=bookmark]:link:after, footer a[rel=bookmark]:visited:after { content: " [" attr(href) "] "; /* Show URLs */ } a { text-decoration: none; } .entry-content img, .comment-content img, .author-avatar img, img.wp-post-image { border-radius: 0; box-shadow: none; } .site { clear: both !important; display: block !important; float: none !important; max-width: 100%; position: relative !important; } .site-header { margin-bottom: 72px; margin-bottom: 5.142857143rem; text-align: left; } .site-header h1 { font-size: 21pt; line-height: 1; text-align: left; } .site-header h2 { color: #000; font-size: 10pt; text-align: left; } .site-header h1 a, .site-header h2 a { color: #000; } .author-avatar, #colophon, #respond, .commentlist .comment-edit-link, .commentlist .reply, .entry-header .comments-link, .entry-meta .edit-link a, .page-link, .site-content nav, .widget-area, img.header-image, .main-navigation { display: none; } .wrapper { border-top: none; box-shadow: none; } .site-content { margin: 0; width: auto; } .entry-header .entry-title, .entry-title { font-size: 21pt; } footer.entry-meta, footer.entry-meta a { color: #444; font-size: 10pt; } .author-description { float: none; width: auto; } /* Comments */ .commentlist > li.comment { background: none; position: relative; width: auto; } .commentlist .avatar { height: 39px; left: 2.2em; top: 2.2em; width: 39px; } .comments-area article header cite, .comments-area article header time { margin-left: 50px; margin-left: 3.57142857rem; } }
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/style.css
CSS
gpl3
36,191
<?php /** * The sidebar containing the main widget area * * If no active widgets are in the sidebar, hide it completely. * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ ?> <?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?> <div id="secondary" class="widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar-1' ); ?> </div><!-- #secondary --> <?php endif; ?>
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/sidebar.php
PHP
gpl3
418
<?php /** * The template for displaying 404 pages (Not Found) * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ get_header(); ?> <div id="primary" class="site-content"> <div id="content" role="main"> <article id="post-0" class="post error404 no-results not-found"> <header class="entry-header"> <h1 class="entry-title"><?php _e( 'This is somewhat embarrassing, isn&rsquo;t it?', 'twentytwelve' ); ?></h1> </header> <div class="entry-content"> <p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'twentytwelve' ); ?></p> <?php get_search_form(); ?> </div><!-- .entry-content --> </article><!-- #post-0 --> </div><!-- #content --> </div><!-- #primary --> <?php get_footer(); ?>
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/404.php
PHP
gpl3
813
<?php /** * The template for displaying a "No posts found" message * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ ?> <article id="post-0" class="post no-results not-found"> <header class="entry-header"> <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1> </header> <div class="entry-content"> <p><?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p> <?php get_search_form(); ?> </div><!-- .entry-content --> </article><!-- #post-0 -->
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/content-none.php
PHP
gpl3
592
/* Styles for older IE versions (previous to IE9). */ body { background-color: #e6e6e6; } body.custom-background-empty { background-color: #fff; } body.custom-background-empty .site, body.custom-background-white .site { box-shadow: none; margin-bottom: 0; margin-top: 0; padding: 0; } .assistive-text, .site .screen-reader-text { clip: rect(1px 1px 1px 1px); /* IE7 */ } .full-width .site-content { float: none; width: 100%; } img.size-full, img.size-large, img.header-image, img.wp-post-image, img[class*="align"], img[class*="wp-image-"], img[class*="attachment-"] { width: auto; /* Prevent stretching of full-size and large-size images with height and width attributes in IE8 */ } .author-avatar { float: left; margin-top: 8px; margin-top: 0.571428571rem; } .author-description { float: right; width: 80%; } .site { box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3); margin: 48px auto; max-width: 960px; overflow: hidden; padding: 0 40px; } .site-content { float: left; width: 65.104166667%; } body.template-front-page .site-content, body.attachment .site-content, body.full-width .site-content { width: 100%; } .widget-area { float: right; width: 26.041666667%; } .site-header h1, .site-header h2 { text-align: left; } .site-header h1 { font-size: 26px; line-height: 1.846153846; } .main-navigation ul.nav-menu, .main-navigation div.nav-menu > ul { border-bottom: 1px solid #ededed; border-top: 1px solid #ededed; display: inline-block !important; text-align: left; width: 100%; } .main-navigation ul { margin: 0; text-indent: 0; } .main-navigation li a, .main-navigation li { display: inline-block; text-decoration: none; } .ie7 .main-navigation li a, .ie7 .main-navigation li { display: inline; } .main-navigation li a { border-bottom: 0; color: #6a6a6a; line-height: 3.692307692; text-transform: uppercase; } .main-navigation li a:hover { color: #000; } .main-navigation li { margin: 0 40px 0 0; position: relative; } .main-navigation li ul { margin: 0; padding: 0; position: absolute; top: 100%; z-index: 1; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); } .ie7 .main-navigation li ul { clip: inherit; display: none; left: 0; overflow: visible; } .main-navigation li ul ul, .ie7 .main-navigation li ul ul { top: 0; left: 100%; } .main-navigation ul li:hover > ul, .main-navigation ul li:focus > ul, .main-navigation .focus > ul { border-left: 0; clip: inherit; overflow: inherit; height: inherit; width: inherit; } .ie7 .main-navigation ul li:hover > ul, .ie7 .main-navigation ul li:focus > ul { display: block; } .main-navigation li ul li a { background: #efefef; border-bottom: 1px solid #ededed; display: block; font-size: 11px; line-height: 2.181818182; padding: 8px 10px; width: 180px; } .main-navigation li ul li a:hover { background: #e3e3e3; color: #444; } .main-navigation .current-menu-item > a, .main-navigation .current-menu-ancestor > a, .main-navigation .current_page_item > a, .main-navigation .current_page_ancestor > a { color: #636363; font-weight: bold; } .menu-toggle { display: none; } .entry-header .entry-title { font-size: 22px; } #respond form input[type="text"] { width: 46.333333333%; } #respond form textarea.blog-textarea { width: 79.666666667%; } .template-front-page .site-content, .template-front-page article { overflow: hidden; } .template-front-page.has-post-thumbnail article { float: left; width: 47.916666667%; } .entry-page-image { float: right; margin-bottom: 0; width: 47.916666667%; } .template-front-page .widget-area .widget, .template-front-page.two-sidebars .widget-area .front-widgets { float: left; margin-bottom: 24px; width: 51.875%; } .template-front-page .widget-area .widget:nth-child(odd) { clear: right; } .template-front-page .widget-area .widget:nth-child(even), .template-front-page.two-sidebars .widget-area .front-widgets + .front-widgets { float: right; margin: 0 0 24px; width: 39.0625%; } .template-front-page.two-sidebars .widget, .template-front-page.two-sidebars .widget:nth-child(even) { float: none; width: auto; } /* =RTL overrides for IE7 and IE8 -------------------------------------------------------------- */ .rtl .site-header h1, .rtl .site-header h2 { text-align: right; } .rtl .widget-area, .rtl .author-description { float: left; } .rtl .author-avatar, .rtl .site-content { float: right; } .rtl .main-navigation ul.nav-menu, .rtl .main-navigation div.nav-menu > ul { text-align: right; } .rtl .main-navigation ul li ul li, .rtl .main-navigation ul li ul li ul li { margin-left: 40px; margin-right: auto; } .rtl .main-navigation li ul ul { position: absolute; bottom: 0; right: 100%; z-index: 1; } .ie7 .rtl .main-navigation li ul ul { position: absolute; bottom: 0; right: 100%; z-index: 1; } .ie7 .rtl .main-navigation ul li { z-index: 99; } .ie7 .rtl .main-navigation li ul { position: absolute; bottom: 100%; right: 0; z-index: 1; } .ie7 .rtl .main-navigation li { margin-right: auto; margin-left: 40px; } .ie7 .rtl .main-navigation li ul ul ul { position: relative; z-index: 1; }
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/css/ie.css
CSS
gpl3
5,115
<?php /** * The sidebar containing the front page widget areas * * If no active widgets are in either sidebar, hide them completely. * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ /* * The front page widget area is triggered if any of the areas * have widgets. So let's check that first. * * If none of the sidebars have widgets, then let's bail early. */ if ( ! is_active_sidebar( 'sidebar-2' ) && ! is_active_sidebar( 'sidebar-3' ) ) return; // If we get this far, we have widgets. Let do this. ?> <div id="secondary" class="widget-area" role="complementary"> <?php if ( is_active_sidebar( 'sidebar-2' ) ) : ?> <div class="first front-widgets"> <?php dynamic_sidebar( 'sidebar-2' ); ?> </div><!-- .first --> <?php endif; ?> <?php if ( is_active_sidebar( 'sidebar-3' ) ) : ?> <div class="second front-widgets"> <?php dynamic_sidebar( 'sidebar-3' ); ?> </div><!-- .second --> <?php endif; ?> </div><!-- #secondary -->
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/sidebar-front.php
PHP
gpl3
980
<?php /** * The template for displaying Comments * * The area of the page that contains both current comments * and the comment form. The actual display of comments is * handled by a callback to twentytwelve_comment() which is * located in the functions.php file. * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ /* * If the current post is protected by a password and * the visitor has not yet entered the password we will * return early without loading the comments. */ if ( post_password_required() ) return; ?> <div id="comments" class="comments-area"> <?php // You can start editing here -- including this comment! ?> <?php if ( have_comments() ) : ?> <h2 class="comments-title"> <?php printf( _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentytwelve' ), number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' ); ?> </h2> <ol class="commentlist"> <?php wp_list_comments( array( 'callback' => 'twentytwelve_comment', 'style' => 'ol' ) ); ?> </ol><!-- .commentlist --> <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?> <nav id="comment-nav-below" class="navigation" role="navigation"> <h1 class="assistive-text section-heading"><?php _e( 'Comment navigation', 'twentytwelve' ); ?></h1> <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentytwelve' ) ); ?></div> <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentytwelve' ) ); ?></div> </nav> <?php endif; // check for comment navigation ?> <?php /* If there are no comments and comments are closed, let's leave a note. * But we only want the note on posts and pages that had comments in the first place. */ if ( ! comments_open() && get_comments_number() ) : ?> <p class="nocomments"><?php _e( 'Comments are closed.' , 'twentytwelve' ); ?></p> <?php endif; ?> <?php endif; // have_comments() ?> <?php comment_form(); ?> </div><!-- #comments .comments-area -->
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/comments.php
PHP
gpl3
2,166
<?php /** * The template used for displaying page content in page.php * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <header class="entry-header"> <?php if ( ! is_page_template( 'page-templates/front-page.php' ) ) : ?> <?php the_post_thumbnail(); ?> <?php endif; ?> <h1 class="entry-title"><?php the_title(); ?></h1> </header> <div class="entry-content"> <?php the_content(); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?> </div><!-- .entry-content --> <footer class="entry-meta"> <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?> </footer><!-- .entry-meta --> </article><!-- #post -->
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/content-page.php
PHP
gpl3
859
<?php /** * The template for displaying Search Results pages * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ get_header(); ?> <section id="primary" class="site-content"> <div id="content" role="main"> <?php if ( have_posts() ) : ?> <header class="page-header"> <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentytwelve' ), '<span>' . get_search_query() . '</span>' ); ?></h1> </header> <?php twentytwelve_content_nav( 'nav-above' ); ?> <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', get_post_format() ); ?> <?php endwhile; ?> <?php twentytwelve_content_nav( 'nav-below' ); ?> <?php else : ?> <article id="post-0" class="post no-results not-found"> <header class="entry-header"> <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1> </header> <div class="entry-content"> <p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'twentytwelve' ); ?></p> <?php get_search_form(); ?> </div><!-- .entry-content --> </article><!-- #post-0 --> <?php endif; ?> </div><!-- #content --> </section><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/search.php
PHP
gpl3
1,347
<?php /** * The template for displaying posts in the Quote post format * * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="entry-content"> <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?> </div><!-- .entry-content --> <footer class="entry-meta"> <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php echo get_the_date(); ?></a> <?php if ( comments_open() ) : ?> <div class="comments-link"> <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?> </div><!-- .comments-link --> <?php endif; // comments_open() ?> <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?> </footer><!-- .entry-meta --> </article><!-- #post -->
01-wordpress-paypal
trunk/wp-content/themes/twentytwelve/content-quote.php
PHP
gpl3
1,113
<?php // Silence is golden. ?>
01-wordpress-paypal
trunk/wp-content/plugins/index.php
PHP
gpl3
30
<?php /* Plugin Name: Registration Plugin URI: http://www.techstorm.com Description: Registration Plugin Version: 1 Author: TechStorm Author URI: http://www.techstorm.com */ add_action('register_form', 'registration_register_form'); function registration_register_form() { $first_name = ( isset($_POST['first_name']) ) ? $_POST['first_name'] : ''; ?> <p> <label for="first_name"><?php _e('First name', 'mydomain') ?><br /> <input type="text" name="first_name" id="first_name" class="input" value="<?php echo esc_attr(stripslashes($first_name)); ?>" size="25" /> </label> </p> <?php } add_filter('registation_errors', 'registration_registration_errors', 10, 3); function registration_registration_errors($error, $sanitized_user_login, $user_email) { if (empty($_POST['first_name'])) $errors->add('first_name_error', __('<strong>ERROR</strong>: You must include a first name.', 'mydomain')); return $errors; } //3. Finally, save our extra registration user meta. add_action('user_register', 'myplugin_user_register'); function myplugin_user_register($user_id) { if (isset($_POST['first_name'])) update_user_meta($user_id, 'first_name', $_POST['first_name']); } function HttpPost($postUrl_, $nvpStr_) { $url = $postUrl_; // Set the curl parameters. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); // Set the request as a POST FIELD for curl. curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpStr_); // Get response from the server. $httpResponse = curl_exec($ch); if (!$httpResponse) { exit("$methodName_ failed: " . curl_error($ch) . '(' . curl_errno($ch) . ')'); } curl_close($ch); return $httpResponse; } function request_for_payment($url_, $code_, $rechargeMinutes_, $ref_, $id1_, $id2_) { $encode = urlencode($code_); $recMinutes = urlencode($rechargeMinutes_); $ref = urlencode($ref_); $id1 = urlencode($id1_); $id2 = urlencode($id2_); $nvpStr = "&code=$encode&rechargeMinutes=$recMinutes&ref=$ref&id1=$id1&id2=$id2"; $httpParsedResponseAr = HttpPost($url_, $nvpStr); echo $httpParsedResponseAr; } function wp_new_user_notification($user_id, $plaintext_pass = '') { $user = new WP_User($user_id); $user_login = stripslashes($user->user_login); $user_email = stripslashes($user->user_email); // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $messageAdmin = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n"; $messageAdmin .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; $messageAdmin .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; //wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); if (empty($plaintext_pass)) return; $messageUser = sprintf(__('Registration completely! Below are your login infomation:')) . "\r\n"; $messageUser .= sprintf(__('Username: %s'), $user_login) . "\r\n"; $messageUser .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; $messageUser .= wp_login_url() . "\r\n"; // wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message); $admess = urlencode($messageAdmin); $usmess = urlencode($messageUser); $pw = urlencode($plaintext_pass); $us = urlencode($user_login); $usmail = urlencode($user_email); $admail = urlencode($messageUser); $site_title = urlencode($blogname); $nvpStr = "&us=$us&pw=$pw&usmess=$usmess&admess=$admess&usmail=$usmail&admail=$admail&site_title=$site_title"; $home_url = get_home_url(); $url = $home_url . '/paypal/paypal.php'; $httpParsedResponseAr = HttpPost($url, $nvpStr); echo $httpParsedResponseAr; // wp_redirect('project01/paypal/paypal.php'); // $mail = new \PHPMailer(); // $mail->IsSMTP(); // $mail->SMTPDebug = 0; // $mail->SMTPAuth = 'login'; // $mail->SMTPSecure = 'ssl'; // $mail->Host = 'smtp.gmail.com'; // <- Server email // $mail->Port = 465; // <- Port của server // $mail->Username = 'vietanh.pd1@gmail.com'; // <- Email của người gửi // $mail->Password = 'nguyenthuydan'; // <- Pass của email người gửi // $mail->SetFrom('vietanh.pd1@gmail.com', 'Việt Anh'); // <- Email của người gửi + tên người gửi // $mail->Subject = 'Test'; // <- Tiêu đề email // $mail->Body = 'The content'; // <- Nội dung email // $mail->AddAddress('vietanh.sgu@gmail.com'); // <- Email của người nhận //// $path = "C://RHDSetup.log"; //// $mail->addAttachment($path); // <- $path là đường dẫn tới file cần đính kèm // $mail->Send(); exit; } //$mail = new \PHPMailer(); // $mail->IsSMTP(); // $mail->SMTPDebug = 0; // $mail->SMTPAuth = 'login'; // $mail->SMTPSecure = 'ssl'; // $mail->Host = 'smtp.gmail.com'; // <- Server email // $mail->Port = 465; // <- Port của server // $mail->Username = 'vinh.thien0301@gmail.com'; // <- Email của người gửi // $mail->Password = 'thien8444443366'; // <- Pass của email người gửi // $mail->SetFrom('vinh.thien0301@gmail.com', $site_title); // <- Email của người gửi + tên người gửi // $mail->Subject = '[Ngoài] New user registration on your site ' . $site_title; // <- Tiêu đề email // $mail->Body = $admin_mess; // <- Nội dung email // $mail->AddAddress($admin_email); // <- Email của người nhận // $mail->Send(); // // $mailUser = new \PHPMailer(); // $mailUser->IsSMTP(); // $mailUser->SMTPDebug = 0; // $mailUser->SMTPAuth = 'login'; // $mailUser->SMTPSecure = 'ssl'; // $mailUser->Host = 'smtp.gmail.com'; // <- Server email // $mailUser->Port = 465; // <- Port của server // $mailUser->Username = 'vinh.thien0301@gmail.com'; // <- Email của người gửi // $mailUser->Password = 'thien8444443366'; // <- Pass của email người gửi // $mailUser->SetFrom('vinh.thien0301@gmail.com', $site_title); // <- Email của người gửi + tên người gửi // $mailUser->Subject = '[Ngoài] Registration Completed! Your Login Information For ' . $site_title; // <- Tiêu đề email // $mailUser->Body = $user_mess; // <- Nội dung email // $mailUser->AddAddress($user_email); // <- Email của người nhận // $mailUser->Send(); ?>
01-wordpress-paypal
trunk/wp-content/plugins/registration/registration.php
PHP
gpl3
7,389
<?php /* Plugin Name: Registration Plugin URI: http://www.facebook.com/techstormteam Description: Registration Plugin Version: 1 Author: TechStorm Author URI: http://www.facebook.com/techstormteam */ add_action('register_form', 'registration_register_form'); function registration_register_form() { $first_name = ( isset($_POST['first_name']) ) ? $_POST['first_name'] : ''; $last_name = ( isset($_POST['last_name']) ) ? $_POST['last_name'] : ''; ?> <p> <label for="first_name"><?php _e('First name', 'mydomain') ?><br /> <input type="text" name="first_name" id="first_name" class="input" value="<?php echo esc_attr(stripslashes($first_name)); ?>" size="25" /> </label> </p> <p> <label for="last_name"><?php _e('Last name', 'mydomain') ?><br /> <input type="text" name="last_name" id="last_name" class="input" value="<?php echo esc_attr(stripslashes($last_name)); ?>" size="25" /> </label> </p> <?php } add_filter('registation_errors', 'registration_registration_errors', 10, 3); function registration_registration_errors($error, $sanitized_user_login, $user_email) { if (empty($_POST['first_name'])) $errors->add('first_name_error', __('<strong>ERROR</strong>: You must include a first name.', 'mydomain')); if (empty($_POST['last_name'])) $errors->add('last_name_error', __('<strong>ERROR</strong>: You must include a last name.', 'mydomain')); return $errors; } //3. Finally, save our extra registration user meta. add_action('user_register', 'myplugin_user_register'); function myplugin_user_register($user_id) { if (isset($_POST['first_name'])) update_user_meta($user_id, 'first_name', $_POST['first_name']); if (isset($_POST['last_name'])) update_user_meta($user_id, 'last_name', $_POST['last_name']); } function HttpPost($postUrl_, $nvpStr_) { $url = $postUrl_; // Set the curl parameters. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); // Set the request as a POST FIELD for curl. curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpStr_); // Get response from the server. $httpResponse = curl_exec($ch); if (!$httpResponse) { exit("$methodName_ failed: " . curl_error($ch) . '(' . curl_errno($ch) . ')'); } curl_close($ch); return $httpResponse; } function wp_new_user_notification($user_id, $plaintext_pass = '') { $user = new WP_User($user_id); $user_login = stripslashes($user->user_login); $user_email = stripslashes($user->user_email); // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $messageAdmin = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n"; $messageAdmin .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; $messageAdmin .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; //wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); if (empty($plaintext_pass)) return; $messageUser = sprintf(__('Registration completely! Below are your login infomation:')) . "\r\n"; $messageUser .= sprintf(__('Username: %s'), $user_login) . "\r\n"; $messageUser .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; $messageUser .= wp_login_url() . "\r\n"; // wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message); $admess = urlencode($messageAdmin); $usmess = urlencode($messageUser); $pw = urlencode($plaintext_pass); $us = urlencode($user_login); $usmail = urlencode($user_email); $admail = urlencode(get_option('admin_email')); $site_title = urlencode($blogname); $nvpStr = "&us=$us&pw=$pw&usmess=$usmess&admess=$admess&usmail=$usmail&admail=$admail&site_title=$site_title"; $home_url = get_home_url(); $url = $home_url . '/paypal/paypal.php'; $httpParsedResponseAr = HttpPost($url, $nvpStr); echo $httpParsedResponseAr; // wp_redirect('project01/paypal/paypal.php'); exit; } ?>
01-wordpress-paypal
trunk/wp-content/plugins/registration/registration_backup.php
PHP
gpl3
4,735
<?php /** * @package Hello_Dolly * @version 1.6 */ /* Plugin Name: Hello Dolly Plugin URI: http://wordpress.org/plugins/hello-dolly/ Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page. Author: Matt Mullenweg Version: 1.6 Author URI: http://ma.tt/ */ function hello_dolly_get_lyric() { /** These are the lyrics to Hello Dolly */ $lyrics = "Hello, Dolly Well, hello, Dolly It's so nice to have you back where you belong You're lookin' swell, Dolly I can tell, Dolly You're still glowin', you're still crowin' You're still goin' strong We feel the room swayin' While the band's playin' One of your old favourite songs from way back when So, take her wrap, fellas Find her an empty lap, fellas Dolly'll never go away again Hello, Dolly Well, hello, Dolly It's so nice to have you back where you belong You're lookin' swell, Dolly I can tell, Dolly You're still glowin', you're still crowin' You're still goin' strong We feel the room swayin' While the band's playin' One of your old favourite songs from way back when Golly, gee, fellas Find her a vacant knee, fellas Dolly'll never go away Dolly'll never go away Dolly'll never go away again"; // Here we split it into lines $lyrics = explode( "\n", $lyrics ); // And then randomly choose a line return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] ); } // This just echoes the chosen line, we'll position it later function hello_dolly() { $chosen = hello_dolly_get_lyric(); echo "<p id='dolly'>$chosen</p>"; } // Now we set that function up to execute when the admin_notices action is called add_action( 'admin_notices', 'hello_dolly' ); // We need some CSS to position the paragraph function dolly_css() { // This makes sure that the positioning is also good for right-to-left languages $x = is_rtl() ? 'left' : 'right'; echo " <style type='text/css'> #dolly { float: $x; padding-$x: 15px; padding-top: 5px; margin: 0; font-size: 11px; } </style> "; } add_action( 'admin_head', 'dolly_css' ); ?>
01-wordpress-paypal
trunk/wp-content/plugins/hello.php
PHP
gpl3
2,255
<?php /** * @package Akismet */ /* Plugin Name: Akismet Plugin URI: http://akismet.com/ Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from comment and trackback spam</strong>. It keeps your site protected from spam even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/">Sign up for an Akismet API key</a>, and 3) Go to your Akismet configuration page, and save your API key. Version: 3.0.0 Author: Automattic Author URI: http://automattic.com/wordpress-plugins/ License: GPLv2 or later Text Domain: akismet */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // Make sure we don't expose any info if called directly if ( !function_exists( 'add_action' ) ) { echo 'Hi there! I\'m just a plugin, not much I can do when called directly.'; exit; } define( 'AKISMET_VERSION', '3.0.0' ); define( 'AKISMET__MINIMUM_WP_VERSION', '3.0' ); define( 'AKISMET__PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'AKISMET_DELETE_LIMIT', 100000 ); register_activation_hook( __FILE__, array( 'Akismet', 'plugin_activation' ) ); register_deactivation_hook( __FILE__, array( 'Akismet', 'plugin_deactivation' ) ); require_once( AKISMET__PLUGIN_DIR . 'class.akismet.php' ); require_once( AKISMET__PLUGIN_DIR . 'class.akismet-widget.php' ); add_action( 'init', array( 'Akismet', 'init' ) ); if ( is_admin() ) { require_once( AKISMET__PLUGIN_DIR . 'class.akismet-admin.php' ); add_action( 'init', array( 'Akismet_Admin', 'init' ) ); } //add wrapper class around deprecated akismet functions that are referenced elsewhere require_once( AKISMET__PLUGIN_DIR . 'wrapper.php' );
01-wordpress-paypal
trunk/wp-content/plugins/akismet/akismet.php
PHP
gpl3
2,417
<?php # Silence is golden.
01-wordpress-paypal
trunk/wp-content/plugins/akismet/index.php
PHP
gpl3
26
<?php class Akismet { const API_HOST = 'rest.akismet.com'; const API_PORT = 80; const MAX_DELAY_BEFORE_MODERATION_EMAIL = 86400; // One day in seconds private static $last_comment = ''; private static $initiated = false; private static $prevent_moderation_email_for_these_comments = array(); private static $last_comment_result = null; public static function init() { if ( ! self::$initiated ) { self::init_hooks(); } } /** * Initializes WordPress hooks */ private static function init_hooks() { self::$initiated = true; add_action( 'wp_insert_comment', array( 'Akismet', 'auto_check_update_meta' ), 10, 2 ); add_action( 'preprocess_comment', array( 'Akismet', 'auto_check_comment' ), 1 ); add_action( 'akismet_scheduled_delete', array( 'Akismet', 'delete_old_comments' ) ); add_action( 'akismet_scheduled_delete', array( 'Akismet', 'delete_old_comments_meta' ) ); add_action( 'akismet_schedule_cron_recheck', array( 'Akismet', 'cron_recheck' ) ); $akismet_comment_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) ); if ( $akismet_comment_nonce_option == 'true' || $akismet_comment_nonce_option == '' ) add_action( 'comment_form', array( 'Akismet', 'add_comment_nonce' ), 1 ); add_action( 'admin_footer-edit-comments.php', array( 'Akismet', 'load_form_js' ) ); add_action( 'comment_form', array( 'Akismet', 'load_form_js' ) ); add_action( 'comment_form', array( 'Akismet', 'inject_ak_js' ) ); add_filter( 'comment_moderation_recipients', array( 'Akismet', 'disable_moderation_emails_if_unreachable' ), 1000, 2 ); add_filter( 'pre_comment_approved', array( 'Akismet', 'last_comment_status' ), 10, 2 ); if ( '3.0.5' == $GLOBALS['wp_version'] ) { remove_filter( 'comment_text', 'wp_kses_data' ); if ( is_admin() ) add_filter( 'comment_text', 'wp_kses_post' ); } } public static function get_api_key() { return defined('WPCOM_API_KEY') ? constant('WPCOM_API_KEY') : get_option('wordpress_api_key'); } public static function check_key_status( $key, $ip = null ) { return self::http_post( http_build_query( array( 'key' => $key, 'blog' => get_option('home') ) ), 'verify-key', $ip ); } public static function verify_key( $key, $ip = null ) { $response = self::check_key_status( $key, $ip ); if ( $response[1] != 'valid' && $response[1] != 'invalid' ) return 'failed'; self::update_alert( $response ); return $response[1]; } public static function auto_check_comment( $commentdata ) { self::$last_comment_result = null; $comment = $commentdata; $comment['user_ip'] = self::get_ip_address(); $comment['user_agent'] = self::get_user_agent(); $comment['referrer'] = self::get_referer(); $comment['blog'] = get_option('home'); $comment['blog_lang'] = get_locale(); $comment['blog_charset'] = get_option('blog_charset'); $comment['permalink'] = get_permalink( $comment['comment_post_ID'] ); if ( !empty( $comment['user_ID'] ) ) $comment['user_role'] = Akismet::get_user_roles( $comment['user_ID'] ); $akismet_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) ); $comment['akismet_comment_nonce'] = 'inactive'; if ( $akismet_nonce_option == 'true' || $akismet_nonce_option == '' ) { $comment['akismet_comment_nonce'] = 'failed'; if ( isset( $_POST['akismet_comment_nonce'] ) && wp_verify_nonce( $_POST['akismet_comment_nonce'], 'akismet_comment_nonce_' . $comment['comment_post_ID'] ) ) $comment['akismet_comment_nonce'] = 'passed'; // comment reply in wp-admin if ( isset( $_POST['_ajax_nonce-replyto-comment'] ) && check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ) ) $comment['akismet_comment_nonce'] = 'passed'; } if ( self::is_test_mode() ) $comment['is_test'] = 'true'; foreach( $_POST as $key => $value ) { if ( is_string( $value ) ) $comment["POST_{$key}"] = $value; } $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' ); foreach ( $_SERVER as $key => $value ) { if ( !in_array( $key, $ignore ) && is_string($value) ) $comment["$key"] = $value; else $comment["$key"] = ''; } $post = get_post( $comment['comment_post_ID'] ); $comment[ 'comment_post_modified_gmt' ] = $post->post_modified_gmt; $response = self::http_post( http_build_query( $comment ), 'comment-check' ); do_action( 'akismet_comment_check_response', $response ); self::update_alert( $response ); $commentdata['comment_as_submitted'] = $comment; $commentdata['akismet_result'] = $response[1]; if ( isset( $response[0]['x-akismet-pro-tip'] ) ) $commentdata['akismet_pro_tip'] = $response[0]['x-akismet-pro-tip']; if ( 'true' == $response[1] ) { // akismet_spam_count will be incremented later by comment_is_spam() self::$last_comment_result = 'spam'; $discard = ( isset( $commentdata['akismet_pro_tip'] ) && $commentdata['akismet_pro_tip'] === 'discard' && self::allow_discard() ); do_action( 'akismet_spam_caught', $discard ); if ( $discard ) { // akismet_result_spam() won't be called so bump the counter here if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); $redirect_to = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : get_permalink( $post ); wp_safe_redirect( esc_url_raw( $redirect_to ) ); die(); } } // if the response is neither true nor false, hold the comment for moderation and schedule a recheck if ( 'true' != $response[1] && 'false' != $response[1] ) { if ( !current_user_can('moderate_comments') ) { // Comment status should be moderated self::$last_comment_result = '0'; } if ( function_exists('wp_next_scheduled') && function_exists('wp_schedule_single_event') ) { if ( !wp_next_scheduled( 'akismet_schedule_cron_recheck' ) ) { wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); } } self::$prevent_moderation_email_for_these_comments[] = $commentdata; } if ( function_exists('wp_next_scheduled') && function_exists('wp_schedule_event') ) { // WP 2.1+: delete old comments daily if ( !wp_next_scheduled( 'akismet_scheduled_delete' ) ) wp_schedule_event( time(), 'daily', 'akismet_scheduled_delete' ); } elseif ( (mt_rand(1, 10) == 3) ) { // WP 2.0: run this one time in ten self::delete_old_comments(); } self::set_last_comment( $commentdata ); self::fix_scheduled_recheck(); return self::$last_comment; } public static function get_last_comment() { return self::$last_comment; } public static function set_last_comment( $comment ) { if ( is_null( $comment ) ) { self::$last_comment = null; } else { // We filter it here so that it matches the filtered comment data that we'll have to compare against later. // wp_filter_comment expects comment_author_IP self::$last_comment = wp_filter_comment( array_merge( array( 'comment_author_IP' => self::get_ip_address() ), $comment ) ); } } // this fires on wp_insert_comment. we can't update comment_meta when auto_check_comment() runs // because we don't know the comment ID at that point. public static function auto_check_update_meta( $id, $comment ) { // failsafe for old WP versions if ( !function_exists('add_comment_meta') ) return false; if ( !isset( self::$last_comment['comment_author_email'] ) ) self::$last_comment['comment_author_email'] = ''; // wp_insert_comment() might be called in other contexts, so make sure this is the same comment // as was checked by auto_check_comment if ( is_object( $comment ) && !empty( self::$last_comment ) && is_array( self::$last_comment ) ) { if ( self::matches_last_comment( $comment ) ) { load_plugin_textdomain( 'akismet' ); // normal result: true or false if ( self::$last_comment['akismet_result'] == 'true' ) { update_comment_meta( $comment->comment_ID, 'akismet_result', 'true' ); self::update_comment_history( $comment->comment_ID, __('Akismet caught this comment as spam', 'akismet'), 'check-spam' ); if ( $comment->comment_approved != 'spam' ) self::update_comment_history( $comment->comment_ID, sprintf( __('Comment status was changed to %s', 'akismet'), $comment->comment_approved), 'status-changed'.$comment->comment_approved ); } elseif ( self::$last_comment['akismet_result'] == 'false' ) { update_comment_meta( $comment->comment_ID, 'akismet_result', 'false' ); self::update_comment_history( $comment->comment_ID, __('Akismet cleared this comment', 'akismet'), 'check-ham' ); if ( $comment->comment_approved == 'spam' ) { if ( wp_blacklist_check($comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent) ) self::update_comment_history( $comment->comment_ID, __('Comment was caught by wp_blacklist_check', 'akismet'), 'wp-blacklisted' ); else self::update_comment_history( $comment->comment_ID, sprintf( __('Comment status was changed to %s', 'akismet'), $comment->comment_approved), 'status-changed-'.$comment->comment_approved ); } } // abnormal result: error else { update_comment_meta( $comment->comment_ID, 'akismet_error', time() ); self::update_comment_history( $comment->comment_ID, sprintf( __('Akismet was unable to check this comment (response: %s), will automatically retry again later.', 'akismet'), substr(self::$last_comment['akismet_result'], 0, 50)), 'check-error' ); } // record the complete original data as submitted for checking if ( isset( self::$last_comment['comment_as_submitted'] ) ) update_comment_meta( $comment->comment_ID, 'akismet_as_submitted', self::$last_comment['comment_as_submitted'] ); if ( isset( self::$last_comment['akismet_pro_tip'] ) ) update_comment_meta( $comment->comment_ID, 'akismet_pro_tip', self::$last_comment['akismet_pro_tip'] ); } } } public static function delete_old_comments() { global $wpdb; while( $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_id FROM {$wpdb->comments} WHERE DATE_SUB(NOW(), INTERVAL 15 DAY) > comment_date_gmt AND comment_approved = 'spam' LIMIT %d", defined( 'AKISMET_DELETE_LIMIT' ) ? AKISMET_DELETE_LIMIT : 10000 ) ) ) { if ( empty( $comment_ids ) ) return; $wpdb->queries = array(); do_action( 'delete_comment', $comment_ids ); $comma_comment_ids = implode( ', ', array_map('intval', $comment_ids) ); $wpdb->query("DELETE FROM {$wpdb->comments} WHERE comment_id IN ( $comma_comment_ids )"); $wpdb->query("DELETE FROM {$wpdb->commentmeta} WHERE comment_id IN ( $comma_comment_ids )"); clean_comment_cache( $comment_ids ); } if ( apply_filters( 'akismet_optimize_table', ( mt_rand(1, 5000) == 11), $wpdb->comments ) ) // lucky number $wpdb->query("OPTIMIZE TABLE {$wpdb->comments}"); } public static function delete_old_comments_meta() { global $wpdb; $interval = apply_filters( 'akismet_delete_commentmeta_interval', 15 ); # enfore a minimum of 1 day $interval = absint( $interval ); if ( $interval < 1 ) $interval = 1; // akismet_as_submitted meta values are large, so expire them // after $interval days regardless of the comment status while ( $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT m.comment_id FROM {$wpdb->commentmeta} as m INNER JOIN {$wpdb->comments} as c USING(comment_id) WHERE m.meta_key = 'akismet_as_submitted' AND DATE_SUB(NOW(), INTERVAL %d DAY) > c.comment_date_gmt LIMIT 10000", $interval ) ) ) { if ( empty( $comment_ids ) ) return; $wpdb->queries = array(); foreach ( $comment_ids as $comment_id ) { delete_comment_meta( $comment_id, 'akismet_as_submitted' ); } } if ( apply_filters( 'akismet_optimize_table', ( mt_rand(1, 5000) == 11), $wpdb->commentmeta ) ) // lucky number $wpdb->query("OPTIMIZE TABLE {$wpdb->commentmeta}"); } // how many approved comments does this author have? public static function get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url ) { global $wpdb; if ( !empty( $user_id ) ) return (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE user_id = %d AND comment_approved = 1", $user_id ) ); if ( !empty( $comment_author_email ) ) return (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE comment_author_email = %s AND comment_author = %s AND comment_author_url = %s AND comment_approved = 1", $comment_author_email, $comment_author, $comment_author_url ) ); return 0; } // get the full comment history for a given comment, as an array in reverse chronological order public static function get_comment_history( $comment_id ) { // failsafe for old WP versions if ( !function_exists('add_comment_meta') ) return false; $history = get_comment_meta( $comment_id, 'akismet_history', false ); usort( $history, array( 'Akismet', '_cmp_time' ) ); return $history; } // log an event for a given comment, storing it in comment_meta public static function update_comment_history( $comment_id, $message, $event=null ) { global $current_user; // failsafe for old WP versions if ( !function_exists('add_comment_meta') ) return false; $user = ''; if ( is_object( $current_user ) && isset( $current_user->user_login ) ) $user = $current_user->user_login; $event = array( 'time' => self::_get_microtime(), 'message' => $message, 'event' => $event, 'user' => $user, ); // $unique = false so as to allow multiple values per comment $r = add_comment_meta( $comment_id, 'akismet_history', $event, false ); } public static function check_db_comment( $id, $recheck_reason = 'recheck_queue' ) { global $wpdb; $c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->comments} WHERE comment_ID = %d", $id ), ARRAY_A ); if ( !$c ) return; $c['user_ip'] = $c['comment_author_IP']; $c['user_agent'] = $c['comment_agent']; $c['referrer'] = ''; $c['blog'] = get_option('home'); $c['blog_lang'] = get_locale(); $c['blog_charset'] = get_option('blog_charset'); $c['permalink'] = get_permalink($c['comment_post_ID']); $c['recheck_reason'] = $recheck_reason; if ( self::is_test_mode() ) $c['is_test'] = 'true'; $response = self::http_post( http_build_query( $c ), 'comment-check' ); return ( is_array( $response ) && ! empty( $response[1] ) ) ? $response[1] : false; } public static function cron_recheck() { global $wpdb; $api_key = self::get_api_key(); $status = self::verify_key( $api_key ); if ( get_option( 'akismet_alert_code' ) || $status == 'invalid' ) { // since there is currently a problem with the key, reschedule a check for 6 hours hence wp_schedule_single_event( time() + 21600, 'akismet_schedule_cron_recheck' ); return false; } delete_option('akismet_available_servers'); $comment_errors = $wpdb->get_col( "SELECT comment_id FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error' LIMIT 100" ); load_plugin_textdomain( 'akismet' ); foreach ( (array) $comment_errors as $comment_id ) { // if the comment no longer exists, or is too old, remove the meta entry from the queue to avoid getting stuck $comment = get_comment( $comment_id ); if ( !$comment || strtotime( $comment->comment_date_gmt ) < strtotime( "-15 days" ) ) { delete_comment_meta( $comment_id, 'akismet_error' ); delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' ); continue; } add_comment_meta( $comment_id, 'akismet_rechecking', true ); $status = self::check_db_comment( $comment_id, 'retry' ); $msg = ''; if ( $status == 'true' ) { $msg = __( 'Akismet caught this comment as spam during an automatic retry.' , 'akismet'); } elseif ( $status == 'false' ) { $msg = __( 'Akismet cleared this comment during an automatic retry.' , 'akismet'); } // If we got back a legit response then update the comment history // other wise just bail now and try again later. No point in // re-trying all the comments once we hit one failure. if ( !empty( $msg ) ) { delete_comment_meta( $comment_id, 'akismet_error' ); self::update_comment_history( $comment_id, $msg, 'cron-retry' ); update_comment_meta( $comment_id, 'akismet_result', $status ); // make sure the comment status is still pending. if it isn't, that means the user has already moved it elsewhere. $comment = get_comment( $comment_id ); if ( $comment && 'unapproved' == wp_get_comment_status( $comment_id ) ) { if ( $status == 'true' ) { wp_spam_comment( $comment_id ); } elseif ( $status == 'false' ) { // comment is good, but it's still in the pending queue. depending on the moderation settings // we may need to change it to approved. if ( check_comment($comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent, $comment->comment_type) ) wp_set_comment_status( $comment_id, 1 ); else if ( get_comment_meta( $comment_id, 'akismet_delayed_moderation_email', true ) ) wp_notify_moderator( $comment_id ); } } delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' ); } else { // If this comment has been pending moderation for longer than MAX_DELAY_BEFORE_MODERATION_EMAIL, // send a moderation email now. if ( ( intval( gmdate( 'U' ) ) - strtotime( $comment->comment_date_gmt ) ) < self::MAX_DELAY_BEFORE_MODERATION_EMAIL ) { delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' ); wp_notify_moderator( $comment_id ); } delete_comment_meta( $comment_id, 'akismet_rechecking' ); wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); return; } delete_comment_meta( $comment_id, 'akismet_rechecking' ); } $remaining = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error'" ); if ( $remaining && !wp_next_scheduled('akismet_schedule_cron_recheck') ) { wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); } } public static function fix_scheduled_recheck() { $future_check = wp_next_scheduled( 'akismet_schedule_cron_recheck' ); if ( !$future_check ) { return; } if ( get_option( 'akismet_alert_code' ) > 0 ) { return; } $check_range = time() + 1200; if ( $future_check > $check_range ) { wp_clear_scheduled_hook( 'akismet_schedule_cron_recheck' ); wp_schedule_single_event( time() + 300, 'akismet_schedule_cron_recheck' ); } } public static function add_comment_nonce( $post_id ) { echo '<p style="display: none;">'; wp_nonce_field( 'akismet_comment_nonce_' . $post_id, 'akismet_comment_nonce', FALSE ); echo '</p>'; } public static function is_test_mode() { return defined('AKISMET_TEST_MODE') && AKISMET_TEST_MODE; } public static function allow_discard() { if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) return false; if ( is_user_logged_in() ) return false; return ( get_option( 'akismet_strictness' ) === '1' ); } public static function get_ip_address() { return isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : null; } /** * Do these two comments, without checking the comment_ID, "match"? * * @param mixed $comment1 A comment object or array. * @param mixed $comment2 A comment object or array. * @return bool Whether the two comments should be treated as the same comment. */ private static function comments_match( $comment1, $comment2 ) { $comment1 = (array) $comment1; $comment2 = (array) $comment2; return ( isset( $comment1['comment_post_ID'], $comment2['comment_post_ID'] ) && intval( $comment1['comment_post_ID'] ) == intval( $comment2['comment_post_ID'] ) && $comment1['comment_author'] == $comment2['comment_author'] && $comment1['comment_author_email'] == $comment2['comment_author_email'] ); } // Does the supplied comment match the details of the one most recently stored in self::$last_comment? public static function matches_last_comment( $comment ) { if ( is_object( $comment ) ) $comment = (array) $comment; return self::comments_match( self::$last_comment, $comment ); } private static function get_user_agent() { return isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : null; } private static function get_referer() { return isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : null; } // return a comma-separated list of role names for the given user public static function get_user_roles( $user_id ) { $roles = false; if ( !class_exists('WP_User') ) return false; if ( $user_id > 0 ) { $comment_user = new WP_User( $user_id ); if ( isset( $comment_user->roles ) ) $roles = join( ',', $comment_user->roles ); } if ( is_multisite() && is_super_admin( $user_id ) ) { if ( empty( $roles ) ) { $roles = 'super_admin'; } else { $comment_user->roles[] = 'super_admin'; $roles = join( ',', $comment_user->roles ); } } return $roles; } // filter handler used to return a spam result to pre_comment_approved public static function last_comment_status( $approved, $comment ) { // Only do this if it's the correct comment if ( is_null(self::$last_comment_result) || ! self::matches_last_comment( $comment ) ) { self::log( "comment_is_spam mismatched comment, returning unaltered $approved" ); return $approved; } // bump the counter here instead of when the filter is added to reduce the possibility of overcounting if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); return self::$last_comment_result; } /** * If Akismet is temporarily unreachable, we don't want to "spam" the blogger with * moderation emails for comments that will be automatically cleared or spammed on * the next retry. * * For comments that will be rechecked later, empty the list of email addresses that * the moderation email would be sent to. * * @param array $emails An array of email addresses that the moderation email will be sent to. * @param int $comment_id The ID of the relevant comment. * @return array An array of email addresses that the moderation email will be sent to. */ public static function disable_moderation_emails_if_unreachable( $emails, $comment_id ) { if ( ! empty( self::$prevent_moderation_email_for_these_comments ) && ! empty( $emails ) ) { $comment = get_comment( $comment_id ); foreach ( self::$prevent_moderation_email_for_these_comments as $possible_match ) { if ( self::comments_match( $possible_match, $comment ) ) { update_comment_meta( $comment_id, 'akismet_delayed_moderation_email', true ); return array(); } } } return $emails; } public static function _cmp_time( $a, $b ) { return $a['time'] > $b['time'] ? -1 : 1; } public static function _get_microtime() { $mtime = explode( ' ', microtime() ); return $mtime[1] + $mtime[0]; } /** * Make a POST request to the Akismet API. * * @param string $request The body of the request. * @param string $path The path for the request. * @param string $ip The specific IP address to hit. * @return array A two-member array consisting of the headers and the response body, both empty in the case of a failure. */ public static function http_post( $request, $path, $ip=null ) { $akismet_ua = sprintf( 'WordPress/%s | Akismet/%s', $GLOBALS['wp_version'], constant( 'AKISMET_VERSION' ) ); $akismet_ua = apply_filters( 'akismet_ua', $akismet_ua ); $content_length = strlen( $request ); $api_key = self::get_api_key(); $host = self::API_HOST; if ( !empty( $api_key ) ) $host = $api_key.'.'.$host; $http_host = $host; // use a specific IP if provided // needed by Akismet_Admin::check_server_connectivity() if ( $ip && long2ip( ip2long( $ip ) ) ) { $http_host = $ip; } $http_args = array( 'body' => $request, 'headers' => array( 'Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option( 'blog_charset' ), 'Host' => $host, 'User-Agent' => $akismet_ua, ), 'httpversion' => '1.0', 'timeout' => 15 ); $akismet_url = "http://{$http_host}/1.1/{$path}"; $response = wp_remote_post( $akismet_url, $http_args ); Akismet::log( compact( 'akismet_url', 'http_args', 'response' ) ); if ( is_wp_error( $response ) ) return array( '', '' ); return array( $response['headers'], $response['body'] ); } // given a response from an API call like check_key_status(), update the alert code options if an alert is present. private static function update_alert( $response ) { $code = $msg = null; if ( isset( $response[0]['x-akismet-alert-code'] ) ) { $code = $response[0]['x-akismet-alert-code']; $msg = $response[0]['x-akismet-alert-msg']; } // only call update_option() if the value has changed if ( $code != get_option( 'akismet_alert_code' ) ) { if ( ! $code ) { delete_option( 'akismet_alert_code' ); delete_option( 'akismet_alert_msg' ); } else { update_option( 'akismet_alert_code', $code ); update_option( 'akismet_alert_msg', $msg ); } } } public static function load_form_js() { wp_enqueue_script( 'akismet-form', AKISMET__PLUGIN_URL . '_inc/form.js', array( 'jquery' ), AKISMET_VERSION ); wp_print_scripts( 'akismet-form' ); } public static function inject_ak_js( $fields ) { echo '<p style="display: none;">'; echo '<input type="hidden" id="ak_js" name="ak_js" value="' . mt_rand( 0, 250 ) . '"/>'; echo '</p>'; } private static function bail_on_activation( $message, $deactivate = true ) { ?> <!doctype html> <html> <head> <meta charset="<?php bloginfo( 'charset' ); ?>"> <style> * { text-align: center; margin: 0; padding: 0; font-family: "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; } p { margin-top: 1em; font-size: 18px; } </style> <body> <p><?php echo esc_html( $message ); ?></p> </body> </html> <?php if ( $deactivate ) { $plugins = get_option( 'active_plugins' ); $akismet = plugin_basename( AKISMET__PLUGIN_DIR . 'akismet.php' ); $update = false; foreach ( $plugins as $i => $plugin ) { if ( $plugin === $akismet ) { $plugins[$i] = false; $update = true; } } if ( $update ) { update_option( 'active_plugins', array_filter( $plugins ) ); } } exit; } public static function view( $name, array $args = array() ) { $args = apply_filters( 'akismet_view_arguments', $args, $name ); foreach ( $args AS $key => $val ) { $$key = $val; } load_plugin_textdomain( 'akismet' ); $file = AKISMET__PLUGIN_DIR . 'views/'. $name . '.php'; include( $file ); } /** * Attached to activate_{ plugin_basename( __FILES__ ) } by register_activation_hook() * @static */ public static function plugin_activation() { if ( version_compare( $GLOBALS['wp_version'], AKISMET__MINIMUM_WP_VERSION, '<' ) ) { load_plugin_textdomain( 'akismet' ); $message = '<strong>'.sprintf(esc_html__( 'Akismet %s requires WordPress %s or higher.' , 'akismet'), AKISMET_VERSION, AKISMET__MINIMUM_WP_VERSION ).'</strong> '.sprintf(__('Please <a href="%1$s">upgrade WordPress</a> to a current version, or <a href="%2$s">downgrade to version 2.4 of the Akismet plugin</a>.', 'akismet'), 'https://codex.wordpress.org/Upgrading_WordPress', 'http://wordpress.org/extend/plugins/akismet/download/'); Akismet::bail_on_activation( $message ); } } /** * Removes all connection options * @static */ public static function plugin_deactivation( ) { //tidy up } public static function log( $akismet_debug ) { if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) error_log( print_r( compact( 'akismet_debug' ), 1 ) ); //send message to debug.log when in debug mode } }
01-wordpress-paypal
trunk/wp-content/plugins/akismet/class.akismet.php
PHP
gpl3
28,375
<?php /** * @package Akismet */ class Akismet_Widget extends WP_Widget { function __construct() { load_plugin_textdomain( 'akismet' ); parent::__construct( 'akismet_widget', __( 'Akismet Widget' , 'akismet'), array( 'description' => __( 'Display the number of spam comments Akismet has caught' , 'akismet') ) ); if ( is_active_widget( false, false, $this->id_base ) ) { add_action( 'wp_head', array( $this, 'css' ) ); } } function css() { ?> <style type="text/css"> .a-stats { width: auto; } .a-stats a { background: #7CA821; background-image:-moz-linear-gradient(0% 100% 90deg,#5F8E14,#7CA821); background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#7CA821),to(#5F8E14)); border: 1px solid #5F8E14; border-radius:3px; color: #CFEA93; cursor: pointer; display: block; font-weight: normal; height: 100%; -moz-border-radius:3px; padding: 7px 0 8px; text-align: center; text-decoration: none; -webkit-border-radius:3px; width: 100%; } .a-stats a:hover { text-decoration: none; background-image:-moz-linear-gradient(0% 100% 90deg,#6F9C1B,#659417); background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#659417),to(#6F9C1B)); } .a-stats .count { color: #FFF; display: block; font-size: 15px; line-height: 16px; padding: 0 13px; white-space: nowrap; } </style> <?php } function form( $instance ) { if ( $instance ) { $title = $instance['title']; } else { $title = __( 'Spam Blocked' , 'akismet'); } ?> <p> <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:' , 'akismet'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /> </p> <?php } function update( $new_instance, $old_instance ) { $instance['title'] = strip_tags( $new_instance['title'] ); return $instance; } function widget( $args, $instance ) { $count = get_option( 'akismet_spam_count' ); echo $args['before_widget']; if ( ! empty( $instance['title'] ) ) { echo $args['before_title']; echo esc_html( $instance['title'] ); echo $args['after_title']; } ?> <div class="a-stats"> <a href="http://akismet.com" target="_blank" title=""><?php printf( _n( '<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>', '<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>', $count , 'akismet'), number_format_i18n( $count ) ); ?></a> </div> <?php echo $args['after_widget']; } } function akismet_register_widgets() { register_widget( 'Akismet_Widget' ); } add_action( 'widgets_init', 'akismet_register_widgets' );
01-wordpress-paypal
trunk/wp-content/plugins/akismet/class.akismet-widget.php
PHP
gpl3
2,719
<?php class Akismet_Admin { const NONCE = 'akismet-update-key'; private static $initiated = false; private static $notices = array(); public static function init() { if ( ! self::$initiated ) { self::init_hooks(); } if ( isset( $_POST['action'] ) && $_POST['action'] == 'enter-key' ) { self::enter_api_key(); } } public static function init_hooks() { // The standalone stats page was removed in 3.0 for an all-in-one config and stats page. // Redirect any links that might have been bookmarked or in browser history. if ( isset( $_GET['page'] ) && 'akismet-stats-display' == $_GET['page'] ) { wp_safe_redirect( esc_url_raw( self::get_page_url( 'stats' ) ), 301 ); die; } self::$initiated = true; add_action( 'admin_init', array( 'Akismet_Admin', 'admin_init' ) ); add_action( 'admin_menu', array( 'Akismet_Admin', 'admin_menu' ), 5 ); # Priority 5, so it's called before Jetpack's admin_menu. add_action( 'admin_notices', array( 'Akismet_Admin', 'display_notice' ) ); add_action( 'admin_enqueue_scripts', array( 'Akismet_Admin', 'load_resources' ) ); add_action( 'activity_box_end', array( 'Akismet_Admin', 'dashboard_stats' ) ); add_action( 'rightnow_end', array( 'Akismet_Admin', 'rightnow_stats' ) ); add_action( 'manage_comments_nav', array( 'Akismet_Admin', 'check_for_spam_button' ) ); add_action( 'transition_comment_status', array( 'Akismet_Admin', 'transition_comment_status' ), 10, 3 ); add_action( 'admin_action_akismet_recheck_queue', array( 'Akismet_Admin', 'recheck_queue' ) ); add_action( 'wp_ajax_akismet_recheck_queue', array( 'Akismet_Admin', 'recheck_queue' ) ); add_action( 'wp_ajax_comment_author_deurl', array( 'Akismet_Admin', 'remove_comment_author_url' ) ); add_action( 'wp_ajax_comment_author_reurl', array( 'Akismet_Admin', 'add_comment_author_url' ) ); add_filter( 'plugin_action_links', array( 'Akismet_Admin', 'plugin_action_links' ), 10, 2 ); add_filter( 'comment_row_actions', array( 'Akismet_Admin', 'comment_row_action' ), 10, 2 ); add_filter( 'comment_text', array( 'Akismet_Admin', 'text_add_link_class' ) ); add_filter( 'plugin_action_links_'.plugin_basename( plugin_dir_path( __FILE__ ) . 'akismet.php'), array( 'Akismet_Admin', 'admin_plugin_settings_link' ) ); } public static function admin_init() { load_plugin_textdomain( 'akismet' ); add_meta_box( 'akismet-status', __('Comment History', 'akismet'), array( 'Akismet_Admin', 'comment_status_meta_box' ), 'comment', 'normal' ); } public static function admin_menu() { if ( class_exists( 'Jetpack' ) ) add_action( 'jetpack_admin_menu', array( 'Akismet_Admin', 'load_menu' ) ); else self::load_menu(); } public static function admin_head() { if ( !current_user_can( 'manage_options' ) ) return; } public static function admin_plugin_settings_link( $links ) { $settings_link = '<a href="'.self::get_page_url().'">'.__('Settings', 'akismet').'</a>'; array_unshift( $links, $settings_link ); return $links; } public static function load_menu() { if ( class_exists( 'Jetpack' ) ) $hook = add_submenu_page( 'jetpack', __( 'Akismet' , 'akismet'), __( 'Akismet' , 'akismet'), 'manage_options', 'akismet-key-config', array( 'Akismet_Admin', 'display_page' ) ); else $hook = add_options_page( __('Akismet', 'akismet'), __('Akismet', 'akismet'), 'manage_options', 'akismet-key-config', array( 'Akismet_Admin', 'display_page' ) ); if ( version_compare( $GLOBALS['wp_version'], '3.3', '>=' ) ) { add_action( "load-$hook", array( 'Akismet_Admin', 'admin_help' ) ); } } public static function load_resources() { global $hook_suffix; if ( in_array( $hook_suffix, array( 'index.php', # dashboard 'edit-comments.php', 'comment.php', 'post.php', 'settings_page_akismet-key-config', 'jetpack_page_akismet-key-config', ) ) ) { wp_register_style( 'akismet.css', AKISMET__PLUGIN_URL . '_inc/akismet.css', array(), AKISMET_VERSION ); wp_enqueue_style( 'akismet.css'); wp_register_script( 'akismet.js', AKISMET__PLUGIN_URL . '_inc/akismet.js', array('jquery','postbox'), AKISMET_VERSION ); wp_enqueue_script( 'akismet.js' ); wp_localize_script( 'akismet.js', 'WPAkismet', array( 'comment_author_url_nonce' => wp_create_nonce( 'comment_author_url_nonce' ), 'strings' => array( 'Remove this URL' => __( 'Remove this URL' , 'akismet'), 'Removing...' => __( 'Removing...' , 'akismet'), 'URL removed' => __( 'URL removed' , 'akismet'), '(undo)' => __( '(undo)' , 'akismet'), 'Re-adding...' => __( 'Re-adding...' , 'akismet'), ) ) ); } } /** * Add help to the Akismet page * * @return false if not the Akismet page */ public static function admin_help() { $current_screen = get_current_screen(); // Screen Content if ( current_user_can( 'manage_options' ) ) { if ( !Akismet::get_api_key() || ( isset( $_GET['view'] ) && $_GET['view'] == 'start' ) ) { //setup page $current_screen->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' , 'akismet'), 'content' => '<p><strong>' . esc_html__( 'Akismet Setup' , 'akismet') . '</strong></p>' . '<p>' . esc_html__( 'Akismet filters out your comment and trackback spam for you, so you can focus on more important things.' , 'akismet') . '</p>' . '<p>' . esc_html__( 'On this page, you are able to setup the Akismet plugin.' , 'akismet') . '</p>', ) ); $current_screen->add_help_tab( array( 'id' => 'setup-signup', 'title' => __( 'New to Akismet' , 'akismet'), 'content' => '<p><strong>' . esc_html__( 'Akismet Setup' , 'akismet') . '</strong></p>' . '<p>' . esc_html__( 'You need to enter an API key to activate the Akismet service on your site.' , 'akismet') . '</p>' . '<p>' . sprintf( __( 'Signup for an account on %s to get an API Key.' , 'akismet'), '<a href="https://akismet.com/plugin-signup/" target="_blank">Akismet.com</a>' ) . '</p>', ) ); $current_screen->add_help_tab( array( 'id' => 'setup-manual', 'title' => __( 'Enter an API Key' , 'akismet'), 'content' => '<p><strong>' . esc_html__( 'Akismet Setup' , 'akismet') . '</strong></p>' . '<p>' . esc_html__( 'If you already have an API key' , 'akismet') . '</p>' . '<ol>' . '<li>' . esc_html__( 'Copy and paste the API key into the text field.' , 'akismet') . '</li>' . '<li>' . esc_html__( 'Click the Use this Key button.' , 'akismet') . '</li>' . '</ol>', ) ); } elseif ( isset( $_GET['view'] ) && $_GET['view'] == 'stats' ) { //stats page $current_screen->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' , 'akismet'), 'content' => '<p><strong>' . esc_html__( 'Akismet Stats' , 'akismet') . '</strong></p>' . '<p>' . esc_html__( 'Akismet filters out your comment and trackback spam for you, so you can focus on more important things.' , 'akismet') . '</p>' . '<p>' . esc_html__( 'On this page, you are able to view stats on spam filtered on your site.' , 'akismet') . '</p>', ) ); } else { //configuration page $current_screen->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' , 'akismet'), 'content' => '<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' . '<p>' . esc_html__( 'Akismet filters out your comment and trackback spam for you, so you can focus on more important things.' , 'akismet') . '</p>' . '<p>' . esc_html__( 'On this page, you are able to enter/remove an API key, view account information and view spam stats.' , 'akismet') . '</p>', ) ); $current_screen->add_help_tab( array( 'id' => 'settings', 'title' => __( 'Settings' , 'akismet'), 'content' => '<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' . '<p><strong>' . esc_html__( 'API Key' , 'akismet') . '</strong> - ' . esc_html__( 'Enter/remove an API key.' , 'akismet') . '</p>' . '<p><strong>' . esc_html__( 'Comments' , 'akismet') . '</strong> - ' . esc_html__( 'Show the number of approved comments beside each comment author in the comments list page.' , 'akismet') . '</p>' . '<p><strong>' . esc_html__( 'Strictness' , 'akismet') . '</strong> - ' . esc_html__( 'Choose to either discard the worst spam automatically or to always put all spam in spam folder.' , 'akismet') . '</p>', ) ); $current_screen->add_help_tab( array( 'id' => 'account', 'title' => __( 'Account' , 'akismet'), 'content' => '<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' . '<p><strong>' . esc_html__( 'Subscription Type' , 'akismet') . '</strong> - ' . esc_html__( 'The Akismet subscription plan' , 'akismet') . '</p>' . '<p><strong>' . esc_html__( 'Status' , 'akismet') . '</strong> - ' . esc_html__( 'The subscription status - active, cancelled or suspended' , 'akismet') . '</p>', ) ); } } // Help Sidebar $current_screen->set_help_sidebar( '<p><strong>' . esc_html__( 'For more information:' , 'akismet') . '</strong></p>' . '<p><a href="https://akismet.com/faq/" target="_blank">' . esc_html__( 'Akismet FAQ' , 'akismet') . '</a></p>' . '<p><a href="https://akismet.com/support/" target="_blank">' . esc_html__( 'Akismet Support' , 'akismet') . '</a></p>' ); } public static function enter_api_key() { if ( function_exists('current_user_can') && !current_user_can('manage_options') ) die(__('Cheatin&#8217; uh?', 'akismet')); if ( !wp_verify_nonce( $_POST['_wpnonce'], self::NONCE ) ) return false; foreach( array( 'akismet_strictness', 'akismet_show_user_comments_approved' ) as $option ) { update_option( $option, isset( $_POST[$option] ) && (int) $_POST[$option] == 1 ? '1' : '0' ); } if ( defined( 'WPCOM_API_KEY' ) ) return false; //shouldn't have option to save key if already defined $new_key = preg_replace( '/[^a-h0-9]/i', '', $_POST['key'] ); $old_key = Akismet::get_api_key(); if ( empty( $new_key ) ) { if ( !empty( $old_key ) ) { delete_option( 'wordpress_api_key' ); self::$notices[] = 'new-key-empty'; } } elseif ( $new_key != $old_key ) { self::save_key( $new_key ); } return true; } public static function save_key( $api_key ) { $key_status = Akismet::verify_key( $api_key ); if ( $key_status == 'valid' ) { $akismet_user = self::get_akismet_user( $api_key ); if ( $akismet_user ) { if ( in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub' ) ) ) update_option( 'wordpress_api_key', $api_key ); if ( $akismet_user->status == 'active' ) self::$notices['status'] = 'new-key-valid'; else self::$notices['status'] = $akismet_user->status; } else self::$notices['status'] = 'new-key-invalid'; } elseif ( in_array( $key_status, array( 'invalid', 'failed' ) ) ) self::$notices['status'] = 'new-key-'.$key_status; } public static function dashboard_stats() { if ( !function_exists('did_action') || did_action( 'rightnow_end' ) ) return; // We already displayed this info in the "Right Now" section if ( !$count = get_option('akismet_spam_count') ) return; global $submenu; echo '<h3>' . esc_html( _x( 'Spam', 'comments' , 'akismet') ) . '</h3>'; echo '<p>'.sprintf( _n( '<a href="%1$s">Akismet</a> has protected your site from <a href="%2$s">%3$s spam comment</a>.', '<a href="%1$s">Akismet</a> has protected your site from <a href="%2$s">%3$s spam comments</a>.', $count , 'akismet'), 'https://akismet.com/wordpress/', esc_url( add_query_arg( array( 'page' => 'akismet-admin' ), admin_url( isset( $submenu['edit-comments.php'] ) ? 'edit-comments.php' : 'edit.php' ) ) ), number_format_i18n($count) ).'</p>'; } // WP 2.5+ public static function rightnow_stats() { global $submenu, $wp_db_version; if ( 8645 < $wp_db_version ) // 2.7 $link = add_query_arg( array( 'comment_status' => 'spam' ), admin_url( 'edit-comments.php' ) ); elseif ( isset( $submenu['edit-comments.php'] ) ) $link = add_query_arg( array( 'page' => 'akismet-admin' ), admin_url( 'edit-comments.php' ) ); else $link = add_query_arg( array( 'page' => 'akismet-admin' ), admin_url( 'edit.php' ) ); if ( $count = get_option('akismet_spam_count') ) { $intro = sprintf( _n( '<a href="%1$s">Akismet</a> has protected your site from %2$s spam comment already. ', '<a href="%1$s">Akismet</a> has protected your site from %2$s spam comments already. ', $count , 'akismet'), 'https://akismet.com/wordpress/', number_format_i18n( $count ) ); } else { $intro = sprintf( __('<a href="%s">Akismet</a> blocks spam from getting to your blog. ', 'akismet'), 'https://akismet.com/wordpress/' ); } $link = function_exists( 'esc_url' ) ? esc_url( $link ) : clean_url( $link ); if ( $queue_count = self::get_spam_count() ) { $queue_text = sprintf( _n( 'There&#8217;s <a href="%2$s">%1$s comment</a> in your spam queue right now.', 'There are <a href="%2$s">%1$s comments</a> in your spam queue right now.', $queue_count , 'akismet'), number_format_i18n( $queue_count ), $link ); } else { $queue_text = sprintf( __( "There&#8217;s nothing in your <a href='%s'>spam queue</a> at the moment." , 'akismet'), $link ); } $text = $intro . '<br />' . $queue_text; echo "<p class='akismet-right-now'>$text</p>\n"; } public static function check_for_spam_button( $comment_status ) { if ( 'approved' == $comment_status ) return; if ( function_exists('plugins_url') ) $link = add_query_arg( array( 'action' => 'akismet_recheck_queue' ), admin_url( 'admin.php' ) ); else $link = add_query_arg( array( 'page' => 'akismet-admin', 'recheckqueue' => 'true', 'noheader' => 'true' ), admin_url( 'edit-comments.php' ) ); echo '</div><div class="alignleft"><a class="button-secondary checkforspam" href="' . esc_url( $link ) . '">' . esc_html__('Check for Spam', 'akismet') . '</a>'; echo '<img src="' . esc_url( admin_url( 'images/wpspin_light.gif' ) ) . '" class="checkforspam-spinner" />'; } public static function transition_comment_status( $new_status, $old_status, $comment ) { if ( $new_status == $old_status ) return; # we don't need to record a history item for deleted comments if ( $new_status == 'delete' ) return; if ( !is_admin() ) return; if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) && !current_user_can( 'moderate_comments' ) ) return; if ( defined('WP_IMPORTING') && WP_IMPORTING == true ) return; // if this is present, it means the status has been changed by a re-check, not an explicit user action if ( get_comment_meta( $comment->comment_ID, 'akismet_rechecking' ) ) return; global $current_user; $reporter = ''; if ( is_object( $current_user ) ) $reporter = $current_user->user_login; // Assumption alert: // We want to submit comments to Akismet only when a moderator explicitly spams or approves it - not if the status // is changed automatically by another plugin. Unfortunately WordPress doesn't provide an unambiguous way to // determine why the transition_comment_status action was triggered. And there are several different ways by which // to spam and unspam comments: bulk actions, ajax, links in moderation emails, the dashboard, and perhaps others. // We'll assume that this is an explicit user action if POST or GET has an 'action' key. if ( isset($_POST['action']) || isset($_GET['action']) ) { if ( $new_status == 'spam' && ( $old_status == 'approved' || $old_status == 'unapproved' || !$old_status ) ) { return self::submit_spam_comment( $comment->comment_ID ); } elseif ( $old_status == 'spam' && ( $new_status == 'approved' || $new_status == 'unapproved' ) ) { return self::submit_nonspam_comment( $comment->comment_ID ); } } Akismet::update_comment_history( $comment->comment_ID, sprintf( __('%1$s changed the comment status to %2$s', 'akismet'), $reporter, $new_status ), 'status-' . $new_status ); } public static function recheck_queue() { global $wpdb; Akismet::fix_scheduled_recheck(); if ( ! ( isset( $_GET['recheckqueue'] ) || ( isset( $_REQUEST['action'] ) && 'akismet_recheck_queue' == $_REQUEST['action'] ) ) ) return; $paginate = ''; if ( isset( $_POST['limit'] ) && isset( $_POST['offset'] ) ) { $paginate = $wpdb->prepare( " LIMIT %d OFFSET %d", array( $_POST['limit'], $_POST['offset'] ) ); } $moderation = $wpdb->get_results( "SELECT * FROM {$wpdb->comments} WHERE comment_approved = '0'{$paginate}", ARRAY_A ); foreach ( (array) $moderation as $c ) { $c['user_ip'] = $c['comment_author_IP']; $c['user_agent'] = $c['comment_agent']; $c['referrer'] = ''; $c['blog'] = get_bloginfo('url'); $c['blog_lang'] = get_locale(); $c['blog_charset'] = get_option('blog_charset'); $c['permalink'] = get_permalink($c['comment_post_ID']); $c['user_role'] = ''; if ( isset( $c['user_ID'] ) ) $c['user_role'] = Akismet::get_user_roles($c['user_ID']); if ( Akismet::is_test_mode() ) $c['is_test'] = 'true'; add_comment_meta( $c['comment_ID'], 'akismet_rechecking', true ); $response = Akismet::http_post( http_build_query( $c ), 'comment-check' ); if ( 'true' == $response[1] ) { wp_set_comment_status( $c['comment_ID'], 'spam' ); update_comment_meta( $c['comment_ID'], 'akismet_result', 'true' ); delete_comment_meta( $c['comment_ID'], 'akismet_error' ); delete_comment_meta( $c['comment_ID'], 'akismet_delayed_moderation_email' ); Akismet::update_comment_history( $c['comment_ID'], __('Akismet re-checked and caught this comment as spam', 'akismet'), 'check-spam' ); } elseif ( 'false' == $response[1] ) { update_comment_meta( $c['comment_ID'], 'akismet_result', 'false' ); delete_comment_meta( $c['comment_ID'], 'akismet_error' ); delete_comment_meta( $c['comment_ID'], 'akismet_delayed_moderation_email' ); Akismet::update_comment_history( $c['comment_ID'], __('Akismet re-checked and cleared this comment', 'akismet'), 'check-ham' ); // abnormal result: error } else { update_comment_meta( $c['comment_ID'], 'akismet_result', 'error' ); Akismet::update_comment_history( $c['comment_ID'], sprintf( __('Akismet was unable to re-check this comment (response: %s)', 'akismet'), substr($response[1], 0, 50)), 'check-error' ); } delete_comment_meta( $c['comment_ID'], 'akismet_rechecking' ); } if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { wp_send_json( array( 'processed' => count((array) $moderation), )); } else { $redirect_to = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : admin_url( 'edit-comments.php' ); wp_safe_redirect( $redirect_to ); exit; } } // Adds an 'x' link next to author URLs, clicking will remove the author URL and show an undo link public static function remove_comment_author_url() { if ( !empty( $_POST['id'] ) && check_admin_referer( 'comment_author_url_nonce' ) ) { $comment = get_comment( intval( $_POST['id'] ), ARRAY_A ); if ( $comment && current_user_can( 'edit_comment', $comment['comment_ID'] ) ) { $comment['comment_author_url'] = ''; do_action( 'comment_remove_author_url' ); print( wp_update_comment( $comment ) ); die(); } } } public static function add_comment_author_url() { if ( !empty( $_POST['id'] ) && !empty( $_POST['url'] ) && check_admin_referer( 'comment_author_url_nonce' ) ) { $comment = get_comment( intval( $_POST['id'] ), ARRAY_A ); if ( $comment && current_user_can( 'edit_comment', $comment['comment_ID'] ) ) { $comment['comment_author_url'] = esc_url( $_POST['url'] ); do_action( 'comment_add_author_url' ); print( wp_update_comment( $comment ) ); die(); } } } public static function comment_row_action( $a, $comment ) { // failsafe for old WP versions if ( !function_exists('add_comment_meta') ) return $a; $akismet_result = get_comment_meta( $comment->comment_ID, 'akismet_result', true ); $akismet_error = get_comment_meta( $comment->comment_ID, 'akismet_error', true ); $user_result = get_comment_meta( $comment->comment_ID, 'akismet_user_result', true); $comment_status = wp_get_comment_status( $comment->comment_ID ); $desc = null; if ( $akismet_error ) { $desc = __( 'Awaiting spam check' , 'akismet'); } elseif ( !$user_result || $user_result == $akismet_result ) { // Show the original Akismet result if the user hasn't overridden it, or if their decision was the same if ( $akismet_result == 'true' && $comment_status != 'spam' && $comment_status != 'trash' ) $desc = __( 'Flagged as spam by Akismet' , 'akismet'); elseif ( $akismet_result == 'false' && $comment_status == 'spam' ) $desc = __( 'Cleared by Akismet' , 'akismet'); } else { $who = get_comment_meta( $comment->comment_ID, 'akismet_user', true ); if ( $user_result == 'true' ) $desc = sprintf( __('Flagged as spam by %s', 'akismet'), $who ); else $desc = sprintf( __('Un-spammed by %s', 'akismet'), $who ); } // add a History item to the hover links, just after Edit if ( $akismet_result ) { $b = array(); foreach ( $a as $k => $item ) { $b[ $k ] = $item; if ( $k == 'edit' || ( $k == 'unspam' && $GLOBALS['wp_version'] >= 3.4 ) ) { $b['history'] = '<a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'#akismet-status" title="'. esc_attr__( 'View comment history' , 'akismet') . '"> '. esc_html__('History', 'akismet') . '</a>'; } } $a = $b; } if ( $desc ) echo '<span class="akismet-status" commentid="'.$comment->comment_ID.'"><a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'#akismet-status" title="' . esc_attr__( 'View comment history' , 'akismet') . '">'.esc_html( $desc ).'</a></span>'; if ( apply_filters( 'akismet_show_user_comments_approved', get_option('akismet_show_user_comments_approved') ) ) { $comment_count = Akismet::get_user_comments_approved( $comment->user_id, $comment->comment_author_email, $comment->comment_author, $comment->comment_author_url ); $comment_count = intval( $comment_count ); echo '<span class="akismet-user-comment-count" commentid="'.$comment->comment_ID.'" style="display:none;"><br><span class="akismet-user-comment-counts">'. sprintf( esc_html( _n( '%s approved', '%s approved', $comment_count , 'akismet') ), number_format_i18n( $comment_count ) ) . '</span></span>'; } return $a; } public static function comment_status_meta_box( $comment ) { $history = Akismet::get_comment_history( $comment->comment_ID ); if ( $history ) { echo '<div class="akismet-history" style="margin: 13px;">'; foreach ( $history as $row ) { $time = date( 'D d M Y @ h:i:m a', $row['time'] ) . ' GMT'; echo '<div style="margin-bottom: 13px;"><span style="color: #999;" alt="' . $time . '" title="' . $time . '">' . sprintf( esc_html__('%s ago', 'akismet'), human_time_diff( $row['time'] ) ) . '</span> - '; echo esc_html( $row['message'] ) . '</div>'; } echo '</div>'; } } public static function plugin_action_links( $links, $file ) { if ( $file == plugin_basename( AKISMET__PLUGIN_URL . '/akismet.php' ) ) { $links[] = '<a href="' . esc_url( self::get_page_url() ) . '">'.esc_html__( 'Settings' , 'akismet').'</a>'; } return $links; } public static function text_add_link_callback( $m ) { // bare link? if ( $m[4] == $m[2] ) return '<a '.$m[1].' href="'.$m[2].'" '.$m[3].' class="comment-link">'.$m[4].'</a>'; else return '<span title="'.$m[2].'" class="comment-link"><a '.$m[1].' href="'.$m[2].'" '.$m[3].' class="comment-link">'.$m[4].'</a></span>'; } public static function text_add_link_class( $comment_text ) { return preg_replace_callback( '#<a ([^>]*)href="([^"]+)"([^>]*)>(.*?)</a>#i', array( 'Akismet_Admin', 'text_add_link_callback' ), $comment_text ); } public static function submit_spam_comment( $comment_id ) { global $wpdb, $current_user, $current_site; $comment_id = (int) $comment_id; $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->comments} WHERE comment_ID = %d", $comment_id ) ); if ( !$comment ) // it was deleted return; if ( 'spam' != $comment->comment_approved ) return; // use the original version stored in comment_meta if available $as_submitted = get_comment_meta( $comment_id, 'akismet_as_submitted', true); if ( $as_submitted && is_array( $as_submitted ) && isset( $as_submitted['comment_content'] ) ) $comment = (object) array_merge( (array)$comment, $as_submitted ); $comment->blog = get_bloginfo('url'); $comment->blog_lang = get_locale(); $comment->blog_charset = get_option('blog_charset'); $comment->permalink = get_permalink($comment->comment_post_ID); if ( is_object($current_user) ) $comment->reporter = $current_user->user_login; if ( is_object($current_site) ) $comment->site_domain = $current_site->domain; $comment->user_role = ''; if ( isset( $comment->user_ID ) ) $comment->user_role = Akismet::get_user_roles( $comment->user_ID ); if ( Akismet::is_test_mode() ) $comment->is_test = 'true'; $post = get_post( $comment->comment_post_ID ); $comment->comment_post_modified_gmt = $post->post_modified_gmt; $response = Akismet::http_post( http_build_query( $comment ), 'submit-spam' ); if ( $comment->reporter ) { Akismet::update_comment_history( $comment_id, sprintf( __('%s reported this comment as spam', 'akismet'), $comment->reporter ), 'report-spam' ); update_comment_meta( $comment_id, 'akismet_user_result', 'true' ); update_comment_meta( $comment_id, 'akismet_user', $comment->reporter ); } do_action('akismet_submit_spam_comment', $comment_id, $response[1]); } public static function submit_nonspam_comment( $comment_id ) { global $wpdb, $current_user, $current_site; $comment_id = (int) $comment_id; $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->comments} WHERE comment_ID = %d", $comment_id ) ); if ( !$comment ) // it was deleted return; // use the original version stored in comment_meta if available $as_submitted = get_comment_meta( $comment_id, 'akismet_as_submitted', true); if ( $as_submitted && is_array($as_submitted) && isset($as_submitted['comment_content']) ) $comment = (object) array_merge( (array)$comment, $as_submitted ); $comment->blog = get_bloginfo('url'); $comment->blog_lang = get_locale(); $comment->blog_charset = get_option('blog_charset'); $comment->permalink = get_permalink( $comment->comment_post_ID ); $comment->user_role = ''; if ( is_object($current_user) ) $comment->reporter = $current_user->user_login; if ( is_object($current_site) ) $comment->site_domain = $current_site->domain; if ( isset( $comment->user_ID ) ) $comment->user_role = Akismet::get_user_roles($comment->user_ID); if ( Akismet::is_test_mode() ) $comment->is_test = 'true'; $post = get_post( $comment->comment_post_ID ); $comment->comment_post_modified_gmt = $post->post_modified_gmt; $response = Akismet::http_post( http_build_query( $comment ), 'submit-ham' ); if ( $comment->reporter ) { Akismet::update_comment_history( $comment_id, sprintf( __('%s reported this comment as not spam', 'akismet'), $comment->reporter ), 'report-ham' ); update_comment_meta( $comment_id, 'akismet_user_result', 'false' ); update_comment_meta( $comment_id, 'akismet_user', $comment->reporter ); } do_action('akismet_submit_nonspam_comment', $comment_id, $response[1]); } // Total spam in queue // get_option( 'akismet_spam_count' ) is the total caught ever public static function get_spam_count( $type = false ) { global $wpdb; if ( !$type ) { // total $count = wp_cache_get( 'akismet_spam_count', 'widget' ); if ( false === $count ) { if ( function_exists('wp_count_comments') ) { $count = wp_count_comments(); $count = $count->spam; } else { $count = (int) $wpdb->get_var("SELECT COUNT(comment_ID) FROM {$wpdb->comments} WHERE comment_approved = 'spam'"); } wp_cache_set( 'akismet_spam_count', $count, 'widget', 3600 ); } return $count; } elseif ( 'comments' == $type || 'comment' == $type ) { // comments $type = ''; } else { // pingback, trackback, ... $type = $wpdb->escape( $type ); } return (int) $wpdb->get_var("SELECT COUNT(comment_ID) FROM {$wpdb->comments} WHERE comment_approved = 'spam' AND comment_type='$type'"); } // Check connectivity between the WordPress blog and Akismet's servers. // Returns an associative array of server IP addresses, where the key is the IP address, and value is true (available) or false (unable to connect). public static function check_server_connectivity() { $test_host = 'rest.akismet.com'; // Some web hosts may disable one or both functions if ( !function_exists('fsockopen') || !function_exists('gethostbynamel') ) return array(); $ips = gethostbynamel( $test_host ); if ( !$ips || !is_array($ips) || !count($ips) ) return array(); $api_key = Akismet::get_api_key(); $servers = array(); foreach ( $ips as $ip ) { $response = Akismet::verify_key( $api_key, $ip ); // even if the key is invalid, at least we know we have connectivity if ( $response == 'valid' || $response == 'invalid' ) $servers[$ip] = true; else $servers[$ip] = false; } return $servers; } // Check the server connectivity and store the results in an option. // Cached results will be used if not older than the specified timeout in seconds; use $cache_timeout = 0 to force an update. // Returns the same associative array as check_server_connectivity() public static function get_server_connectivity( $cache_timeout = 86400 ) { $servers = get_option('akismet_available_servers'); if ( (time() - get_option('akismet_connectivity_time') < $cache_timeout) && $servers !== false ) return $servers; // There's a race condition here but the effect is harmless. $servers = self::check_server_connectivity(); update_option('akismet_available_servers', $servers); update_option('akismet_connectivity_time', time()); return $servers; } public static function get_number_spam_waiting() { global $wpdb; return (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error'" ); } public static function get_page_url( $page = 'config' ) { $args = array( 'page' => 'akismet-key-config' ); if ( $page == 'stats' ) $args = array( 'page' => 'akismet-key-config', 'view' => 'stats' ); elseif ( $page == 'delete_key' ) $args = array( 'page' => 'akismet-key-config', 'view' => 'start', 'action' => 'delete-key', '_wpnonce' => wp_create_nonce( self::NONCE ) ); $url = add_query_arg( $args, class_exists( 'Jetpack' ) ? admin_url( 'admin.php' ) : admin_url( 'options-general.php' ) ); return $url; } public static function get_akismet_user( $api_key ) { $akismet_user = Akismet::http_post( http_build_query( array( 'key' => $api_key ) ), 'get-subscription' ); if ( ! empty( $akismet_user[1] ) ) $akismet_user = json_decode( $akismet_user[1] ); else $akismet_user = false; return $akismet_user; } public static function get_stats( $api_key ) { $stat_totals = array(); foreach( array( '6-months', 'all' ) as $interval ) { $response = Akismet::http_post( http_build_query( array( 'blog' => urlencode( get_bloginfo('url') ), 'key' => $api_key, 'from' => $interval ) ), 'get-stats' ); if ( ! empty( $response[1] ) ) { $stat_totals[$interval] = json_decode( $response[1] ); } } return $stat_totals; } public static function verify_wpcom_key( $api_key, $user_id, $token = '' ) { $akismet_account = Akismet::http_post( http_build_query( array( 'user_id' => $user_id, 'api_key' => $api_key, 'token' => $token, 'get_account_type' => 'true' ) ), 'verify-wpcom-key' ); if ( ! empty( $akismet_account[1] ) ) $akismet_account = json_decode( $akismet_account[1] ); Akismet::log( compact( 'akismet_account' ) ); return $akismet_account; } public static function display_alert() { Akismet::view( 'notice', array( 'type' => 'alert', 'code' => (int) get_option( 'akismet_alert_code' ), 'msg' => get_option( 'akismet_alert_msg' ) ) ); } public static function display_spam_check_warning() { Akismet::fix_scheduled_recheck(); if ( self::get_number_spam_waiting() > 0 && wp_next_scheduled('akismet_schedule_cron_recheck') > time() ) Akismet::view( 'notice', array( 'type' => 'spam-check' ) ); } public static function display_invalid_version() { Akismet::view( 'notice', array( 'type' => 'version' ) ); } public static function display_api_key_warning() { Akismet::view( 'notice', array( 'type' => 'plugin' ) ); } public static function display_page() { if ( !Akismet::get_api_key() || ( isset( $_GET['view'] ) && $_GET['view'] == 'start' ) ) self::display_start_page(); elseif ( isset( $_GET['view'] ) && $_GET['view'] == 'stats' ) self::display_stats_page(); else self::display_configuration_page(); } public static function display_start_page() { if ( isset( $_GET['action'] ) ) { if ( $_GET['action'] == 'delete-key' ) { if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], self::NONCE ) ) delete_option( 'wordpress_api_key' ); } } if ( $api_key = Akismet::get_api_key() ) { self::display_configuration_page(); return; } //the user can choose to auto connect their API key by clicking a button on the akismet done page //if jetpack, get verified api key by using connected wpcom user id //if no jetpack, get verified api key by using an akismet token $akismet_user = false; if ( isset( $_GET['token'] ) && preg_match('/^(\d+)-[0-9a-f]{20}$/', $_GET['token'] ) ) $akismet_user = self::verify_wpcom_key( '', '', $_GET['token'] ); elseif ( $jetpack_user = self::get_jetpack_user() ) $akismet_user = self::verify_wpcom_key( $jetpack_user['api_key'], $jetpack_user['user_id'] ); if ( isset( $_GET['action'] ) ) { if ( $_GET['action'] == 'save-key' ) { if ( is_object( $akismet_user ) ) { self::save_key( $akismet_user->api_key ); self::display_notice(); self::display_configuration_page(); return; } } } echo '<h2 class="ak-header">'.esc_html__('Akismet', 'akismet').'</h2>'; self::display_status(); Akismet::view( 'start', compact( 'akismet_user' ) ); } public static function display_stats_page() { Akismet::view( 'stats' ); } public static function display_configuration_page() { $api_key = Akismet::get_api_key(); $akismet_user = self::get_akismet_user( $api_key ); $stat_totals = self::get_stats( $api_key ); // If unset, create the new strictness option using the old discard option to determine its default if ( get_option( 'akismet_strictness' ) === false ) add_option( 'akismet_strictness', (get_option('akismet_discard_month') === 'true' ? '1' : '0') ); if ( empty( self::$notices ) ) { //show status if ( $akismet_user->status == 'active' && $akismet_user->account_type == 'free-api-key' ) { $time_saved = false; if ( $stat_totals['all']->time_saved > 1800 ) { $total_in_minutes = round( $stat_totals['all']->time_saved / 60 ); $total_in_hours = round( $total_in_minutes / 60 ); $total_in_days = round( $total_in_hours / 8 ); $cleaning_up = __( 'Cleaning up spam takes time.' , 'akismet'); if ( $total_in_days > 1 ) $time_saved = $cleaning_up . ' ' . sprintf( __( 'Since you joined us, Akismet has saved you %s days!' , 'akismet'), number_format_i18n( $total_in_days ) ); elseif ( $total_in_hours > 1 ) $time_saved = $cleaning_up . ' ' . sprintf( __( 'Since you joined us, Akismet has saved you %d hours!' , 'akismet'), $total_in_hours ); elseif ( $total_in_minutes >= 30 ) $time_saved = $cleaning_up . ' ' . sprintf( __( 'Since you joined us, Akismet has saved you %d minutes!' , 'akismet'), $total_in_minutes ); } Akismet::view( 'notice', array( 'type' => 'active-notice', 'time_saved' => $time_saved ) ); } if ( !empty( $akismet_user->limit_reached ) && in_array( $akismet_user->limit_reached, array( 'yellow', 'red' ) ) ) { Akismet::view( 'notice', array( 'type' => 'limit-reached', 'level' => $akismet_user->limit_reached ) ); } } if ( !isset( self::$notices['status'] ) && in_array( $akismet_user->status, array( 'cancelled', 'suspended', 'missing', 'no-sub' ) ) ) Akismet::view( 'notice', array( 'type' => $akismet_user->status ) ); Akismet::log( compact( 'stat_totals', 'akismet_user' ) ); Akismet::view( 'config', compact( 'api_key', 'akismet_user', 'stat_totals' ) ); } public static function display_notice() { global $hook_suffix; if ( in_array( $hook_suffix, array( 'jetpack_page_akismet-key-config', 'settings_page_akismet-key-config', 'edit-comments.php' ) ) && (int) get_option( 'akismet_alert_code' ) > 0 ) { self::display_alert(); } elseif ( $hook_suffix == 'plugins.php' && !Akismet::get_api_key() ) { self::display_api_key_warning(); } elseif ( $hook_suffix == 'edit-comments.php' && wp_next_scheduled( 'akismet_schedule_cron_recheck' ) ) { self::display_spam_check_warning(); } elseif ( in_array( $hook_suffix, array( 'jetpack_page_akismet-key-config', 'settings_page_akismet-key-config' ) ) && Akismet::get_api_key() ) { self::display_status(); } } public static function display_status() { $servers = self::get_server_connectivity(); $fail_count = count( $servers ) - count( array_filter( $servers ) ); $type = ''; if ( empty( $servers ) || $fail_count > 0 ) $type = 'servers-be-down'; if ( !function_exists('fsockopen') || !function_exists('gethostbynamel') ) $type = 'missing-functions'; if ( !empty( $type ) ) Akismet::view( 'notice', compact( 'type' ) ); elseif ( !empty( self::$notices ) ) { foreach ( self::$notices as $type ) Akismet::view( 'notice', compact( 'type' ) ); } } private static function get_jetpack_user() { if ( !class_exists('Jetpack') ) return false; Jetpack::load_xml_rpc_client(); $xml = new Jetpack_IXR_ClientMulticall( array( 'user_id' => get_current_user_id() ) ); $xml->addCall( 'wpcom.getUserID' ); $xml->addCall( 'akismet.getAPIKey' ); $xml->query(); Akismet::log( compact( 'xml' ) ); if ( !$xml->isError() ) { $responses = $xml->getResponse(); if ( count( $responses ) > 1 ) { $api_key = array_shift( $responses[0] ); $user_id = (int) array_shift( $responses[1] ); return compact( 'api_key', 'user_id' ); } } return false; } }
01-wordpress-paypal
trunk/wp-content/plugins/akismet/class.akismet-admin.php
PHP
gpl3
39,179
<?php global $wpcom_api_key, $akismet_api_host, $akismet_api_port; $wpcom_api_key = defined( 'WPCOM_API_KEY' ) ? constant( 'WPCOM_API_KEY' ) : ''; $akismet_api_host = Akismet::get_api_key() . '.rest.akismet.com'; $akismet_api_port = 80; function akismet_test_mode() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::is_test_mode()' ); return Akismet::is_test_mode(); } function akismet_http_post( $request, $host, $path, $port = 80, $ip = null ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::http_post()' ); $path = str_ireplace( '/1.1/', '', $path ); return Akismet::http_post( $request, $path, $ip ); } function akismet_microtime() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::_get_microtime()' ); return Akismet::_get_microtime(); } function akismet_delete_old() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::delete_old_comments()' ); return Akismet::delete_old_comments(); } function akismet_delete_old_metadata() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::delete_old_comments_meta()' ); return Akismet::delete_old_comments_meta(); } function akismet_check_db_comment( $id, $recheck_reason = 'recheck_queue' ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::check_db_comment()' ); return Akismet::check_db_comment( $id, $recheck_reason ); } function akismet_rightnow() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::rightnow_stats()' ); if ( !class_exists( 'Akismet_Admin' ) ) return false; return Akismet_Admin::rightnow_stats(); } function akismet_admin_init() { _deprecated_function( __FUNCTION__, '3.0' ); } function akismet_version_warning() { _deprecated_function( __FUNCTION__, '3.0' ); } function akismet_load_js_and_css() { _deprecated_function( __FUNCTION__, '3.0' ); } function akismet_nonce_field( $action = -1 ) { _deprecated_function( __FUNCTION__, '3.0', 'wp_nonce_field' ); return wp_nonce_field( $action ); } function akismet_plugin_action_links( $links, $file ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::plugin_action_links()' ); return Akismet_Admin::plugin_action_links( $links, $file ); } function akismet_conf() { _deprecated_function( __FUNCTION__, '3.0' ); } function akismet_stats_display() { _deprecated_function( __FUNCTION__, '3.0' ); } function akismet_stats() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::dashboard_stats()' ); return Akismet_Admin::dashboard_stats(); } function akismet_admin_warnings() { _deprecated_function( __FUNCTION__, '3.0' ); } function akismet_comment_row_action( $a, $comment ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::comment_row_action()' ); return Akismet_Admin::comment_row_actions( $a, $comment ); } function akismet_comment_status_meta_box( $comment ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::comment_status_meta_box()' ); return Akismet_Admin::comment_status_meta_box( $comment ); } function akismet_comments_columns( $columns ) { _deprecated_function( __FUNCTION__, '3.0' ); return $columns; } function akismet_comment_column_row( $column, $comment_id ) { _deprecated_function( __FUNCTION__, '3.0' ); } function akismet_text_add_link_callback( $m ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::text_add_link_callback()' ); return Akismet_Admin::text_add_link_callback( $m ); } function akismet_text_add_link_class( $comment_text ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::text_add_link_class()' ); return Akismet_Admin::text_add_link_class( $comment_text ); } function akismet_check_for_spam_button( $comment_status ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::check_for_spam_button()' ); return Akismet_Admin::check_for_spam_button( $comment_status ); } function akismet_submit_nonspam_comment( $comment_id ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::submit_nonspam_comment()' ); return Akismet_Admin::submit_nonspam_comment( $comment_id ); } function akismet_submit_spam_comment( $comment_id ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::submit_spam_comment()' ); return Akismet_Admin::submit_spam_comment( $comment_id ); } function akismet_transition_comment_status( $new_status, $old_status, $comment ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::transition_comment_status()' ); return Akismet_Admin::transition_comment_status( $new_status, $old_status, $comment ); } function akismet_spam_count( $type = false ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::get_spam_count()' ); return Akismet_Admin::get_spam_count( $type ); } function akismet_recheck_queue() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::recheck_queue()' ); return Akismet_Admin::recheck_queue(); } function akismet_remove_comment_author_url() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::remove_comment_author_url()' ); return Akismet_Admin::remove_comment_author_url(); } function akismet_add_comment_author_url() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::add_comment_author_url()' ); return Akismet_Admin::add_comment_author_url(); } function akismet_check_server_connectivity() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::check_server_connectivity()' ); return Akismet_Admin::check_server_connectivity(); } function akismet_get_server_connectivity( $cache_timeout = 86400 ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::()' ); return Akismet_Admin::get_server_connectivity( $cache_timeout ); } function akismet_server_connectivity_ok() { _deprecated_function( __FUNCTION__, '3.0' ); return true; } function akismet_admin_menu() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::admin_menu()' ); return Akismet_Admin::admin_menu(); } function akismet_load_menu() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet_Admin::load_menu()' ); return Akismet_Admin::load_menu(); } function akismet_init() { _deprecated_function( __FUNCTION__, '3.0' ); } function akismet_get_key() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::get_api_key()' ); return Akismet::get_api_key(); } function akismet_check_key_status( $key, $ip = null ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::check_key_status()' ); return Akismet::check_key_status( $key, $ip ); } function akismet_update_alert( $response ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::update_alert()' ); return Akismet::update_alert( $response ); } function akismet_verify_key( $key, $ip = null ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::verify_key()' ); return Akismet::verify_key( $key, $ip ); } function akismet_get_user_roles( $user_id ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::get_user_roles()' ); return Akismet::get_user_roles( $user_id ); } function akismet_result_spam( $approved ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::comment_is_spam()' ); return Akismet::comment_is_spam( $approved ); } function akismet_result_hold( $approved ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::comment_needs_moderation()' ); return Akismet::comment_needs_moderation( $approved ); } function akismet_get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::get_user_comments_approved()' ); return Akismet::get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url ); } function akismet_update_comment_history( $comment_id, $message, $event = null ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::update_comment_history()' ); return Akismet::update_comment_history( $comment_id, $message, $event ); } function akismet_get_comment_history( $comment_id ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::get_comment_history()' ); return Akismet::get_comment_history( $comment_id ); } function akismet_cmp_time( $a, $b ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::_cmp_time()' ); return Akismet::_cmp_time( $a, $b ); } function akismet_auto_check_update_meta( $id, $comment ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::auto_check_update_meta()' ); return Akismet::auto_check_update_meta( $id, $comment ); } function akismet_auto_check_comment( $commentdata ) { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::auto_check_comment()' ); return Akismet::auto_check_comment( $commentdata ); } function akismet_get_ip_address() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::get_ip_address()' ); return Akismet::get_ip_address(); } function akismet_cron_recheck() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::cron_recheck()' ); return Akismet::cron_recheck(); } function akismet_add_comment_nonce() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::add_comment_nonce()' ); return Akismet::add_comment_nonce( $post_id ); } function akismet_fix_scheduled_recheck() { _deprecated_function( __FUNCTION__, '3.0', 'Akismet::fix_scheduled_recheck()' ); return Akismet::fix_scheduled_recheck(); } function akismet_spam_comments() { _deprecated_function( __FUNCTION__, '3.0' ); return array(); } function akismet_spam_totals() { _deprecated_function( __FUNCTION__, '3.0' ); return array(); } function akismet_manage_page() { _deprecated_function( __FUNCTION__, '3.0' ); } function akismet_caught() { _deprecated_function( __FUNCTION__, '3.0' ); } function redirect_old_akismet_urls() { _deprecated_function( __FUNCTION__, '3.0' ); } function akismet_kill_proxy_check( $option ) { _deprecated_function( __FUNCTION__, '3.0' ); return 0; }
01-wordpress-paypal
trunk/wp-content/plugins/akismet/wrapper.php
PHP
gpl3
9,736
#submitted-on { position: relative; } #the-comment-list .author .akismet-user-comment-count { display: inline; } #the-comment-list .author a span { text-decoration: none; color: #999; } #the-comment-list .author a span.akismet-span-link { text-decoration: inherit; color: inherit; } #the-comment-list .remove_url { margin-left: 3px; color: #999; padding: 2px 3px 2px 0; } #the-comment-list .remove_url:hover { color: #A7301F; font-weight: bold; padding: 2px 2px 2px 0; } #dashboard_recent_comments .akismet-status { display: none; } .akismet-status { float: right; } .akismet-status a { color: #AAA; font-style: italic; } span.comment-link a { text-decoration: underline; } span.comment-link:after { content: " "attr(title) " "; color: #aaa; text-decoration: none; } .mshot-arrow { width: 0; height: 0; border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-right: 10px solid #5C5C5C; position: absolute; left: -6px; top: 91px; } .mshot-container { background: #5C5C5C; position: absolute; top: -94px; padding: 7px; width: 450px; height: 338px; z-index: 20000; -moz-border-radius: 6px; border-radius: 6px; -webkit-border-radius: 6px; } h2.ak-header { padding: 30px; background: #649316 url('img/logo-full-2x.png') no-repeat 20px center; background-size: 185px 33px; height: 33px; text-indent: -9999em; margin-right: 10px; } .checkforspam { display: inline-block !important; } .checkforspam-spinner { display: none; margin-top: 10px; } .config-wrap { margin-top: 2em; max-width: 700px; } .activate-option { background: #e3e3e3; border-radius: 3px; margin-bottom: 30px; overflow: hidden; padding: 20px; } .activate-option.clicked { background: #649316; color: #fff; } .activate-option.clicked:hover { background: #68802E; color: #fff; } .activate-option .button.button-secondary { margin: 15px 0; } .activate-option p { margin: 10px 0 10px; } .activate-highlight { background: #fff; padding: 30px; margin-right: 10px; } .activate-highlight.secondary { background: #ddd; padding: 20px 30px; } .activate-highlight h3 { margin: 0 0 0.3em; } .activate-highlight p { color: #777; } .activate-highlight .button-primary { margin-top: 15px; } #akismet-enter-api-key .regular-text { width: 18em; margin-top: 15px; } .right { float: right; } .alert-text { color: #dd3d36; } .success { color: #649316; } .option-description { float: left; font-size: 16px; } .option-description span { color: #666; display: block; font-size: 14px; margin-top: 5px; } .option-action { float: right; } .key-config-link { font-size: 14px; margin-left: 20px; } .jetpack-account { float: left; font-size: 18px; margin-right: 40px; } .small-heading { color: #777; display: block; font-size: 12px; font-weight: bold; margin-bottom: 5px; text-transform: uppercase; } .inline-label { background: #ddd; border-radius: 3px; font-size: 11px; padding: 3px 8px; text-transform: uppercase; } .inline-label.alert { background: #e54747; color: #fff; } .jetpack-account .inline-label { margin-left: 5px; } .option-action .manual-key { margin-top: 7px; } .alert { border: 1px solid #e5e5e5; padding: 0.4em 1em 1.4em 1em; border-radius: 3px; -webkit-border-radius: 3px; border-width: 1px; border-style: solid; } .alert h3.key-status { color: #fff; margin: 1em 0 0.5em 0; } .alert.critical { background-color: #993300; } .alert.active { background-color: #649316; } .alert p.key-status { font-size: 24px; } .alert p.description { color:#fff; font-size: 14px; margin: 0 0; font-style: normal; } .alert p.description a, .alert p.description a, .alert p.description a, .alert p.description a { color: #fff; } .new-snapshot { margin-top: 1em; padding: 1em; text-align: center; } .new-snapshot.stats { background: #fff; border: 1px solid #e5e5e5; } .new-snapshot h3 { background: #f5f5f5; color: #888; font-size: 11px; margin: 0; padding: 3px; } .new-snapspot ul { font-size: 12px; width: 100%; } .new-snapshot ul li { color: #999; float: left; font-size: 11px; padding: 0 20px; text-transform: uppercase; width: 33%; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -ms-box-sizing: border-box; } .new-snapshot.stats ul li:first-child, .new-snapshot.stats ul li:nth-child(2) { border-right:1px dotted #ccc; } .new-snapshot.account ul li:nth-child(2) { border-right: none; } .new-snapshot ul li span { color: #52accc; display: block; font-size: 32px; font-weight: lighter; line-height: 1.5em; } .new-snapshot.stats { } .new-snapshot.account, .new-snapshot.settings { float: left; padding: 0; text-align: left; width: 50%; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -ms-box-sizing: border-box; } .account-container { background: #fff; border: 1px solid #e5e5e5; margin-right: 0.5em; } .settings-container { background: #fff; border: 1px solid #e5e5e5; margin-left: 0.5em; } .new-snapshot.account ul li { width:100% } .new-snapshot.account ul li span { font-size: 14px; font-weight: normal; } .new-snapshot.settings ul li { border: none; display: block; width:100% } .new-snapshot.settings ul li span { display: block; font-size: 14px; font-weight: normal; } .new-snapshot.settings p.submit { margin: 0; text-align: center; } .akismet-settings th.strictness { vertical-align: top; padding-top: 15px; } .akismet-settings input[type=text] { width: 75%; } .akismet-settings span.note{ float: left; padding-left: 23px; font-size: 75%; margin-top: -10px; } .clearfix { clear:both; }
01-wordpress-paypal
trunk/wp-content/plugins/akismet/_inc/akismet.css
CSS
gpl3
5,911
jQuery( function ( $ ) { var ak_js = $( '#ak_js' ); // If the form field already exists just use that if ( ak_js.length == 0 ) { ak_js = $( '<input type="hidden" id="ak_js" name="ak_js" />' ); } else { ak_js.remove(); } ak_js.val( ( new Date() ).getTime() ); // single page, front-end comment form // inline comment reply, wp-admin $( '#commentform, #replyrow td:first' ).append( ak_js ); } );
01-wordpress-paypal
trunk/wp-content/plugins/akismet/_inc/form.js
JavaScript
gpl3
411
jQuery( function ( $ ) { $( 'a.activate-option' ).click( function(){ var link = $( this ); if ( link.hasClass( 'clicked' ) ) { link.removeClass( 'clicked' ); } else { link.addClass( 'clicked' ); } $( '.toggle-have-key' ).slideToggle( 'slow', function() {}); return false; }); $('.akismet-status').each(function () { var thisId = $(this).attr('commentid'); $(this).prependTo('#comment-' + thisId + ' .column-comment'); }); $('.akismet-user-comment-count').each(function () { var thisId = $(this).attr('commentid'); $(this).insertAfter('#comment-' + thisId + ' .author strong:first').show(); }); $('#the-comment-list').find('tr.comment, tr[id ^= "comment-"]').find('.column-author a[title ^= "http://"]').each(function () { var thisTitle = $(this).attr('title'); thisCommentId = $(this).parents('tr:first').attr('id').split("-"); $(this).attr("id", "author_comment_url_"+ thisCommentId[1]); if (thisTitle) { $(this).after( $( '<a href="#" class="remove_url">x</a>' ) .attr( 'commentid', thisCommentId[1] ) .attr( 'title', WPAkismet.strings['Remove this URL'] ) ); } }); $('.remove_url').live('click', function () { var thisId = $(this).attr('commentid'); var data = { action: 'comment_author_deurl', _wpnonce: WPAkismet.comment_author_url_nonce, id: thisId }; $.ajax({ url: ajaxurl, type: 'POST', data: data, beforeSend: function () { // Removes "x" link $("a[commentid='"+ thisId +"']").hide(); // Show temp status $("#author_comment_url_"+ thisId).html( $( '<span/>' ).text( WPAkismet.strings['Removing...'] ) ); }, success: function (response) { if (response) { // Show status/undo link $("#author_comment_url_"+ thisId) .attr('cid', thisId) .addClass('akismet_undo_link_removal') .html( $( '<span/>' ).text( WPAkismet.strings['URL removed'] ) ) .append( ' ' ) .append( $( '<span/>' ) .text( WPAkismet.strings['(undo)'] ) .addClass( 'akismet-span-link' ) ); } } }); return false; }); $('.akismet_undo_link_removal').live('click', function () { var thisId = $(this).attr('cid'); var thisUrl = $(this).attr('href').replace("http://www.", "").replace("http://", ""); var data = { action: 'comment_author_reurl', _wpnonce: WPAkismet.comment_author_url_nonce, id: thisId, url: thisUrl }; $.ajax({ url: ajaxurl, type: 'POST', data: data, beforeSend: function () { // Show temp status $("#author_comment_url_"+ thisId).html( $( '<span/>' ).text( WPAkismet.strings['Re-adding...'] ) ); }, success: function (response) { if (response) { // Add "x" link $("a[commentid='"+ thisId +"']").show(); // Show link $("#author_comment_url_"+ thisId).removeClass('akismet_undo_link_removal').html(thisUrl); } } }); return false; }); $('a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type').mouseover(function () { var wpcomProtocol = ( 'https:' === location.protocol ) ? 'https://' : 'http://'; // Need to determine size of author column var thisParentWidth = $(this).parent().width(); // It changes based on if there is a gravatar present thisParentWidth = ($(this).parent().find('.grav-hijack').length) ? thisParentWidth - 42 + 'px' : thisParentWidth + 'px'; if ($(this).find('.mShot').length == 0 && !$(this).hasClass('akismet_undo_link_removal')) { var self = $( this ); $('.widefat td').css('overflow', 'visible'); $(this).css('position', 'relative'); var thisHref = $.URLEncode( $(this).attr('href') ); $(this).append('<div class="mShot mshot-container" style="left: '+thisParentWidth+'"><div class="mshot-arrow"></div><img src="//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450" width="450" class="mshot-image" style="margin: 0;" /></div>'); setTimeout(function () { self.find( '.mshot-image' ).attr('src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=2'); }, 6000); setTimeout(function () { self.find( '.mshot-image' ).attr('src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=3'); }, 12000); } else { $(this).find('.mShot').css('left', thisParentWidth).show(); } }).mouseout(function () { $(this).find('.mShot').hide(); }); $('.checkforspam:not(.button-disabled)').click( function(e) { $('.checkforspam:not(.button-disabled)').addClass('button-disabled'); $('.checkforspam-spinner').show(); akismet_check_for_spam(0, 100); e.preventDefault(); }); function akismet_check_for_spam(offset, limit) { $.post( ajaxurl, { 'action': 'akismet_recheck_queue', 'offset': offset, 'limit': limit }, function(result) { if (result.processed < limit) { window.location.reload(); } else { akismet_check_for_spam(offset + limit, limit); } } ); } }); // URL encode plugin jQuery.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/; while(x<c.length){var m=r.exec(c.substr(x)); if(m!=null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length; }else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16); o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;} });
01-wordpress-paypal
trunk/wp-content/plugins/akismet/_inc/akismet.js
JavaScript
gpl3
5,267
<div class="no-key config-wrap"><?php if ( $akismet_user && in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub', 'missing', 'cancelled', 'suspended' ) ) ) : if ( $akismet_user->status == 'missing' ) :?> <p><?php esc_html_e('Akismet eliminates the comment and trackback spam you get on your site. Register your email address below to get started.', 'akismet'); ?></p> <div class="activate-highlight activate-option"> <div class="option-description"> <strong class="small-heading"><?php esc_html_e('Connected via Jetpack', 'akismet'); ?></strong> <?php echo esc_attr( $akismet_user->user_email ); ?> </div> <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="right" target="_blank"> <input type="hidden" name="passback_url" value="<?php echo esc_attr( Akismet_Admin::get_page_url() ); ?>"/> <input type="hidden" name="auto-connect" value="<?php echo $akismet_user->ID;?>"/> <input type="hidden" name="redirect" value="plugin-signup"/> <input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Register Akismet' , 'akismet'); ?>"/> </form> </div> <?php elseif ( $akismet_user->status == 'cancelled' ) :?> <p><?php esc_html_e('Akismet eliminates the comment and trackback spam you get on your site.', 'akismet'); ?></p> <div class="activate-highlight activate-option"> <div class="option-description" style="width:75%;"> <strong class="small-heading"><?php esc_html_e('Connected via Jetpack', 'akismet'); ?></strong> <?php printf( esc_html__( 'Your subscription for %s is cancelled' , 'akismet'), $akismet_user->user_email ); ?> </div> <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="right" target="_blank"> <input type="hidden" name="passback_url" value="<?php echo esc_attr( Akismet_Admin::get_page_url() ); ?>"/> <input type="hidden" name="user_id" value="<?php echo $akismet_user->ID;?>"/> <input type="hidden" name="redirect" value="upgrade"/> <input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Reactivate Akismet' , 'akismet'); ?>"/> </form> </div> <?php elseif ( $akismet_user->status == 'suspended' ) : ?> <p><?php esc_html_e('Akismet eliminates the comment and trackback spam you get on your site.', 'akismet'); ?></p> <div class="activate-highlight centered activate-option"> <strong class="small-heading"><?php esc_html_e( 'Connected via Jetpack' , 'akismet'); ?></strong> <h3 class="alert-text"><?php printf( esc_html__( 'Your subscription for %s is suspended' , 'akismet'), $akismet_user->user_email ); ?></h3> <p><?php esc_html_e('No worries! Get in touch and we&#8217;ll help sort this out.', 'akismet'); ?></p> <a href="https://akismet.com/contact" class="button button-primary"><?php esc_html_e( 'Contact Akismet support' , 'akismet'); ?></a> </div> <?php else : // ask do they want to use akismet account found using jetpack wpcom connection ?> <p style="margin-right:10px"><?php esc_html_e('Akismet eliminates the comment and trackback spam you get on your site. To setup Akismet, select one of the options below.', 'akismet'); ?></p> <div class="activate-highlight activate-option"> <div class="option-description"> <strong class="small-heading"><?php esc_html_e('Connected via Jetpack', 'akismet'); ?></strong> <?php echo esc_attr( $akismet_user->user_email ); ?> </div> <form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate" class="right"> <input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key );?>"/> <input type="hidden" name="action" value="enter-key"> <?php wp_nonce_field( Akismet_Admin::NONCE ) ?> <input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Use this Akismet account' , 'akismet'); ?>"/> </form> </div> <?php endif;?> <div class="activate-highlight secondary activate-option"> <div class="option-description"> <strong><?php esc_html_e('Create a new API key with a different email address', 'akismet'); ?></strong> <p><?php esc_html_e('Use this option if you want to setup a new Akismet account.', 'akismet'); ?></p> </div> <?php Akismet::view( 'get', array( 'text' => __( 'Register a different email address' , 'akismet'), 'classes' => array( 'right', 'button', 'button-secondary' ) ) ); ?> </div> <div class="activate-highlight secondary activate-option"> <div class="option-description"> <strong><?php esc_html_e('Manually enter an API key', 'akismet'); ?></strong> <p><?php esc_html_e('If you already know your API key.', 'akismet'); ?></p> </div> <form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-enter-api-key" class="right"> <input id="key" name="key" type="text" size="15" maxlength="12" value="" class="regular-text code"> <input type="hidden" name="action" value="enter-key"> <?php wp_nonce_field( Akismet_Admin::NONCE ) ?> <input type="submit" name="submit" id="submit" class="button button-secondary" value="<?php esc_attr_e('Use this key', 'akismet');?>"> </form> </div> <?php else :?> <p><?php esc_html_e('Akismet eliminates the comment and trackback spam you get on your site. To setup Akismet, select one of the options below.', 'akismet'); ?></p> <div class="activate-highlight activate-option"> <div class="option-description"> <strong><?php esc_html_e( 'Activate Akismet' , 'akismet');?></strong> <p><?php esc_html_e('Log in or create an account to get your API key.', 'akismet'); ?></p> </div> <?php Akismet::view( 'get', array( 'text' => __( 'Get your API key' , 'akismet'), 'classes' => array( 'right', 'button', 'button-primary' ) ) ); ?> </div> <div class="activate-highlight secondary activate-option"> <div class="option-description"> <strong><?php esc_html_e('Manually enter an API key', 'akismet'); ?></strong> <p><?php esc_html_e('If you already know your API key.', 'akismet'); ?></p> </div> <form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-enter-api-key" class="right"> <input id="key" name="key" type="text" size="15" maxlength="12" value="" class="regular-text code"> <input type="hidden" name="action" value="enter-key"> <?php wp_nonce_field( Akismet_Admin::NONCE ); ?> <input type="submit" name="submit" id="submit" class="button button-secondary" value="<?php esc_attr_e('Use this key', 'akismet');?>"> </form> </div><?php endif;?> </div>
01-wordpress-paypal
trunk/wp-content/plugins/akismet/views/start.php
PHP
gpl3
6,521
<div class="wrap"> <h2><?php esc_html_e( 'Akismet' , 'akismet');?></h2> <div class="have-key"> <?php if ( $stat_totals && isset( $stat_totals['all'] ) && (int) $stat_totals['all']->spam > 0 ) : ?> <div class="new-snapshot stats"> <span style="float:right;margin:10px 15px -5px 0px"> <a href="<?php echo esc_url( Akismet_Admin::get_page_url( 'stats' ) ); ?>" class=""><?php esc_html_e( 'Summaries' , 'akismet');?></a> </span> <iframe allowtransparency="true" scrolling="no" frameborder="0" style="width: 100%; height: 215px; overflow: hidden;" src="<?php printf( '//akismet.com/web/1.0/snapshot.php?blog=%s&api_key=%s&height=180&locale=%s', urlencode( get_bloginfo('url') ), Akismet::get_api_key(), get_locale() );?>"></iframe> <ul> <li> <h3><?php esc_html_e( 'Past six months' , 'akismet');?></h3> <span><?php echo number_format( $stat_totals['6-months']->spam );?></span> <?php esc_html_e( 'Spam blocked' , 'akismet');?> </li> <li> <h3><?php esc_html_e( 'All time' , 'akismet');?></h3> <span><?php echo number_format( $stat_totals['all']->spam );?></span> <?php esc_html_e( 'Spam blocked' , 'akismet');?> </li> <li> <h3><?php esc_html_e( 'Accuracy' , 'akismet');?></h3> <span><?php echo $stat_totals['all']->accuracy; ?>%</span> <?php printf( esc_html( _n( '%s missed spam, %s false positive', '%s missed spam, %s false positives', $stat_totals['all']->false_positives , 'akismet') ), number_format( $stat_totals['all']->missed_spam ), number_format( $stat_totals['all']->false_positives ) ); ?> </li> </ul> <div class="clearfix"></div> </div> <?php endif;?> <?php if ( $akismet_user ):?> <div id="wpcom-stats-meta-box-container" class="metabox-holder"><?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> <script type="text/javascript"> jQuery(document).ready( function($) { jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed'); if(typeof postboxes !== 'undefined') postboxes.add_postbox_toggles( 'plugins_page_akismet-key-config' ); }); </script> <div class="postbox-container" style="width: 55%;margin-right: 10px;"> <div id="normal-sortables" class="meta-box-sortables ui-sortable"> <div id="referrers" class="postbox "> <div class="handlediv" title="Click to toggle"><br></div> <h3 class="hndle"><span><?php esc_html_e( 'Settings' , 'akismet');?></span></h3> <form name="akismet_conf" id="akismet-conf" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST"> <div class="inside"> <table cellspacing="0" class="akismet-settings"> <tbody> <?php if ( !defined( 'WPCOM_API_KEY' ) ):?> <tr> <th width="10%" align="left" scope="row"><?php esc_html_e('API Key', 'akismet');?></th> <td width="5%"/> <td align="left"> <span class="api-key"><input id="key" name="key" type="text" size="15" maxlength="12" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="regular-text code <?php echo $akismet_user->status;?>"></span> </td> </tr> <?php endif; ?> <tr> <th align="left" scope="row"><?php esc_html_e('Comments', 'akismet');?></th> <td></td> <td align="left"> <p> <label for="akismet_show_user_comments_approved" title="<?php esc_attr_e( 'Show approved comments' , 'akismet'); ?>"><input name="akismet_show_user_comments_approved" id="akismet_show_user_comments_approved" value="1" type="checkbox" <?php checked('1', get_option('akismet_show_user_comments_approved')); ?>> <?php esc_html_e('Show the number of approved comments beside each comment author', 'akismet'); ?></label> </p> </td> </tr> <tr> <th class="strictness" align="left" scope="row"><?php esc_html_e('Strictness', 'akismet'); ?></th> <td></td> <td align="left"> <fieldset><legend class="screen-reader-text"><span><?php esc_html_e('Akismet anti-spam strictness', 'akismet'); ?></span></legend> <p><label for="akismet_strictness_1"><input type="radio" name="akismet_strictness" id="akismet_strictness_1" value="1" <?php checked('1', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Silently discard the worst and most pervasive spam so I never see it.', 'akismet'); ?></label></p> <p><label for="akismet_strictness_0"><input type="radio" name="akismet_strictness" id="akismet_strictness_0" value="0" <?php checked('0', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Always put spam in the Spam folder for review.', 'akismet'); ?></label></p> </fieldset> <span class="note"><strong><?php esc_html_e('Note:', 'akismet');?></strong> <?php printf( __( 'Spam in the <a href="%s">spam folder</a> older than 15 days is deleted automatically.' , 'akismet'), admin_url( 'edit-comments.php?comment_status=spam' ) );?></span> </td> </tr> </tbody> </table> </div> <div id="major-publishing-actions"> <?php if ( !defined( 'WPCOM_API_KEY' ) ):?> <div id="delete-action"> <a class="submitdelete deletion" href="<?php echo esc_url( Akismet_Admin::get_page_url( 'delete_key' ) ); ?>"><?php esc_html_e('Disconnect this account', 'akismet'); ?></a> </div> <?php endif; ?> <?php wp_nonce_field(Akismet_Admin::NONCE) ?> <div id="publishing-action"> <input type="hidden" name="action" value="enter-key"> <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e('Save Changes', 'akismet');?>"> </div> <div class="clear"></div> </div> </form> </div> </div> </div> <div class="postbox-container" style="width:44%;"> <div id="normal-sortables" class="meta-box-sortables ui-sortable"> <div id="referrers" class="postbox "> <div class="handlediv" title="Click to toggle"><br></div> <h3 class="hndle"><span><?php esc_html_e( 'Account' , 'akismet');?></span></h3> <div class="inside"> <table cellspacing="0"> <tbody> <tr> <th scope="row" align="left"><?php esc_html_e( 'Subscription Type' , 'akismet');?></th> <td width="5%"/> <td align="left"> <span><?php echo $akismet_user->account_name; ?></span> </td> </tr> <tr> <th scope="row" align="left"><?php esc_html_e( 'Status' , 'akismet');?></th> <td width="5%"/> <td align="left"> <span><?php if ( 'cancelled' == $akismet_user->status ) : esc_html_e( 'Cancelled', 'akismet' ); elseif ( 'suspended' == $akismet_user->status ) : esc_html_e( 'Suspended', 'akismet' ); elseif ( 'missing' == $akismet_user->status ) : esc_html_e( 'Missing', 'akismet' ); elseif ( 'no-sub' == $akismet_user->status ) : esc_html_e( 'No Subscription Found', 'akismet' ); else : esc_html_e( 'Active', 'akismet' ); endif; ?></span> </td> </tr> <?php if ( $akismet_user->next_billing_date ) : ?> <tr> <th scope="row" align="left"><?php esc_html_e( 'Next Billing Date' , 'akismet');?></th> <td width="5%"/> <td align="left"> <span><?php echo date( 'F j, Y', $akismet_user->next_billing_date ); ?></span> </td> </tr> <?php endif; ?> </tbody> </table> </div> <div id="major-publishing-actions"> <div id="publishing-action"> <?php Akismet::view( 'get', array( 'text' => ( $akismet_user->account_type == 'free-api-key' && $akismet_user->status == 'active' ? __( 'Upgrade' , 'akismet') : __( 'Change' , 'akismet') ), 'redirect' => 'upgrade' ) ); ?> </div> <div class="clear"></div> </div> </div> </div> </div> </div> <?php endif;?> </div> </div>
01-wordpress-paypal
trunk/wp-content/plugins/akismet/views/config.php
PHP
gpl3
8,465
<form name="akismet_activate" action="https://akismet.com/get/" method="POST" target="_blank"> <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/> <input type="hidden" name="redirect" value="<?php echo isset( $redirect ) ? $redirect : 'plugin-signup'; ?>"/> <input type="submit" class="<?php echo isset( $classes ) && count( $classes ) > 0 ? implode( ' ', $classes ) : 'button button-primary';?>" value="<?php echo esc_attr( $text ); ?>"/> </form>
01-wordpress-paypal
trunk/wp-content/plugins/akismet/views/get.php
PHP
gpl3
505
<tr valign="top"> <th scope="row"><?php esc_html_e('Akismet anti-spam strictness', 'akismet'); ?></th> <td><fieldset><legend class="screen-reader-text"><span><?php esc_html_e('Akismet anti-spam strictness', 'akismet'); ?></span></legend> <p><label for="akismet_strictness_1"><input type="radio" name="akismet_strictness" id="akismet_strictness_1" value="1" <?php checked('1', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Strict: silently discard the worst and most pervasive spam.', 'akismet'); ?></label></p> <p><label for="akismet_strictness_0"><input type="radio" name="akismet_strictness" id="akismet_strictness_0" value="0" <?php checked('0', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Safe: always put spam in the Spam folder for review.', 'akismet'); ?></label></p> </fieldset></td> </tr>
01-wordpress-paypal
trunk/wp-content/plugins/akismet/views/strict.php
PHP
gpl3
830
<div class="wrap"> <h2><?php esc_html_e( 'Akismet Stats' , 'akismet');?><?php if ( !isset( $hide_settings_link ) ): ?> <a href="<?php echo esc_url( Akismet_Admin::get_page_url() );?>" class="add-new-h2"><?php esc_html_e( 'Settings' , 'akismet');?></a><?php endif;?></h2> <iframe src="<?php echo esc_url( sprintf( '//akismet.com/web/1.0/user-stats.php?blog=%s&api_key=%s&locale=%s', urlencode( get_bloginfo('url') ), Akismet::get_api_key(), get_locale() ) ); ?>" width="100%" height="2500px" frameborder="0" id="akismet-stats-frame"></iframe> </div>
01-wordpress-paypal
trunk/wp-content/plugins/akismet/views/stats.php
PHP
gpl3
551
<?php /** Sets up the WordPress Environment. */ require( dirname(__FILE__) . '/wp-load.php' ); add_action( 'wp_head', 'wp_no_robots' ); require( dirname( __FILE__ ) . '/wp-blog-header.php' ); if ( is_array( get_site_option( 'illegal_names' )) && isset( $_GET[ 'new' ] ) && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) == true ) { wp_redirect( network_home_url() ); die(); } /** * Prints signup_header via wp_head * * @since MU */ function do_signup_header() { /** * Fires within the <head> section of the site sign-up screen. * * @since 3.0.0 */ do_action( 'signup_header' ); } add_action( 'wp_head', 'do_signup_header' ); if ( !is_multisite() ) { wp_redirect( site_url('wp-login.php?action=register') ); die(); } if ( !is_main_site() ) { wp_redirect( network_site_url( 'wp-signup.php' ) ); die(); } // Fix for page title $wp_query->is_404 = false; /** * Prints styles for front-end Multisite signup pages * * @since MU */ function wpmu_signup_stylesheet() { ?> <style type="text/css"> .mu_register { width: 90%; margin:0 auto; } .mu_register form { margin-top: 2em; } .mu_register .error { font-weight:700; padding:10px; color:#333333; background:#FFEBE8; border:1px solid #CC0000; } .mu_register input[type="submit"], .mu_register #blog_title, .mu_register #user_email, .mu_register #blogname, .mu_register #user_name { width:100%; font-size: 24px; margin:5px 0; } .mu_register .prefix_address, .mu_register .suffix_address {font-size: 18px;display:inline; } .mu_register label { font-weight:700; font-size:15px; display:block; margin:10px 0; } .mu_register label.checkbox { display:inline; } .mu_register .mu_alert { font-weight:700; padding:10px; color:#333333; background:#ffffe0; border:1px solid #e6db55; } </style> <?php } add_action( 'wp_head', 'wpmu_signup_stylesheet' ); get_header(); /** * Fires before the site sign-up form. * * @since 3.0.0 */ do_action( 'before_signup_form' ); ?> <div id="content" class="widecolumn"> <div class="mu_register"> <?php /** * Generates and displays the Signup and Create Site forms * * @since MU * * @param string $blogname The new site name * @param string $blog_title The new site title * @param array $errors */ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { $current_site = get_current_site(); // Blog name if ( !is_subdomain_install() ) echo '<label for="blogname">' . __('Site Name:') . '</label>'; else echo '<label for="blogname">' . __('Site Domain:') . '</label>'; if ( $errmsg = $errors->get_error_message('blogname') ) { ?> <p class="error"><?php echo $errmsg ?></p> <?php } if ( !is_subdomain_install() ) echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" /><br />'; else echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) ) . '</span><br />'; if ( !is_user_logged_in() ) { if ( !is_subdomain_install() ) $site = $current_site->domain . $current_site->path . __( 'sitename' ); else $site = __( 'domain' ) . '.' . $site_domain . $current_site->path; echo '<p>(<strong>' . sprintf( __('Your address will be %s.'), $site ) . '</strong>) ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '</p>'; } // Blog Title ?> <label for="blog_title"><?php _e('Site Title:') ?></label> <?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?> <p class="error"><?php echo $errmsg ?></p> <?php } echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_attr($blog_title).'" />'; ?> <div id="privacy"> <p class="privacy-intro"> <label for="blog_public_on"><?php _e('Privacy:') ?></label> <?php _e( 'Allow search engines to index this site.' ); ?> <br style="clear:both" /> <label class="checkbox" for="blog_public_on"> <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if ( !isset( $_POST['blog_public'] ) || $_POST['blog_public'] == '1' ) { ?>checked="checked"<?php } ?> /> <strong><?php _e( 'Yes' ); ?></strong> </label> <label class="checkbox" for="blog_public_off"> <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if ( isset( $_POST['blog_public'] ) && $_POST['blog_public'] == '0' ) { ?>checked="checked"<?php } ?> /> <strong><?php _e( 'No' ); ?></strong> </label> </p> </div> <?php /** * Fires after the site sign-up form. * * @since 3.0.0 * * @param array $errors An array possibly containing 'blogname' or 'blog_title' errors. */ do_action( 'signup_blogform', $errors ); } /** * Validate the new site signup * * @since MU * * @uses wp_get_current_user() to retrieve the current user * @uses wpmu_validate_blog_signup() to validate new site signup for the current user * @return array Contains the new site data and error messages. */ function validate_blog_form() { $user = ''; if ( is_user_logged_in() ) $user = wp_get_current_user(); return wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user); } /** * Display user registration form * * @since MU * * @param string $user_name The entered username * @param string $user_email The entered email address * @param array $errors */ function show_user_form($user_name = '', $user_email = '', $errors = '') { // User name echo '<label for="user_name">' . __('Username:') . '</label>'; if ( $errmsg = $errors->get_error_message('user_name') ) { echo '<p class="error">'.$errmsg.'</p>'; } echo '<input name="user_name" type="text" id="user_name" value="'. esc_attr($user_name) .'" maxlength="60" /><br />'; _e( '(Must be at least 4 characters, letters and numbers only.)' ); ?> <label for="user_email"><?php _e( 'Email&nbsp;Address:' ) ?></label> <?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?> <p class="error"><?php echo $errmsg ?></p> <?php } ?> <input name="user_email" type="text" id="user_email" value="<?php echo esc_attr($user_email) ?>" maxlength="200" /><br /><?php _e('We send your registration email to this address. (Double-check your email address before continuing.)') ?> <?php if ( $errmsg = $errors->get_error_message('generic') ) { echo '<p class="error">' . $errmsg . '</p>'; } /** * Fires at the end of the user registration form on the site sign-up form. * * @since 3.0.0 * * @param array $errors An array possibly containing 'user_name' or 'user_email' errors. */ do_action( 'signup_extra_fields', $errors ); } /** * Validate user signup name and email * * @since MU * * @uses wpmu_validate_user_signup() to retrieve an array of user data * @return array Contains username, email, and error messages. */ function validate_user_form() { return wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']); } /** * Allow returning users to sign up for another site * * @since MU * * @uses wp_get_current_user() to get the current user * @param string $blogname The new site name * @param string $blog_title The new blog title * @param array $errors */ function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) { $current_user = wp_get_current_user(); if ( ! is_wp_error($errors) ) { $errors = new WP_Error(); } $signup_defaults = array( 'blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ); /** * Filter the default site sign-up variables. * * @since 3.0.0 * * @param array $signup_defaults { * An array of default site sign-up variables. * * @type string $blogname The site blogname. * @type string $blog_title The site title. * @type array $errors An array possibly containing 'blogname' or 'blog_title' errors. * } */ $filtered_results = apply_filters( 'signup_another_blog_init', $signup_defaults ); $blogname = $filtered_results['blogname']; $blog_title = $filtered_results['blog_title']; $errors = $filtered_results['errors']; echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_current_site()->site_name ) . '</h2>'; if ( $errors->get_error_code() ) { echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>'; } ?> <p><?php printf( __( 'Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart&#8217;s content, but write responsibly!' ), $current_user->display_name ) ?></p> <?php $blogs = get_blogs_of_user($current_user->ID); if ( !empty($blogs) ) { ?> <p><?php _e( 'Sites you are already a member of:' ) ?></p> <ul> <?php foreach ( $blogs as $blog ) { $home_url = get_home_url( $blog->userblog_id ); echo '<li><a href="' . esc_url( $home_url ) . '">' . $home_url . '</a></li>'; } ?> </ul> <?php } ?> <p><?php _e( 'If you&#8217;re not going to use a great site domain, leave it for a new user. Now have at it!' ) ?></p> <form id="setupform" method="post" action="wp-signup.php"> <input type="hidden" name="stage" value="gimmeanotherblog" /> <?php /** * Hidden sign-up form fields output when creating another site or user. * * @since MU * * @param string $context A string describing the steps of the sign-up process. The value can be * 'create-another-site', 'validate-user', or 'validate-site'. */ do_action( 'signup_hidden_fields', 'create-another-site' ); ?> <?php show_blog_form($blogname, $blog_title, $errors); ?> <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ) ?>" /></p> </form> <?php } /** * Validate a new blog signup * * @since MU * * @uses wp_get_current_user() to retrieve the current user * @uses wpmu_create_blog() to add a new site * @uses confirm_another_blog_signup() to confirm the user's new site signup * @return bool True if blog signup was validated, false if error */ function validate_another_blog_signup() { global $wpdb, $blogname, $blog_title, $errors, $domain, $path; $current_user = wp_get_current_user(); if ( !is_user_logged_in() ) die(); $result = validate_blog_form(); extract($result); if ( $errors->get_error_code() ) { signup_another_blog($blogname, $blog_title, $errors); return false; } $public = (int) $_POST['blog_public']; $blog_meta_defaults = array( 'lang_id' => 1, 'public' => $public ); /** * Filter the new site meta variables. * * @since MU * @deprecated 3.0.0 Use the 'add_signup_meta' filter instead. * * @param array $blog_meta_defaults An array of default blog meta variables. */ $meta = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults ); /** * Filter the new default site meta variables. * * @since 3.0.0 * * @param array $meta { * An array of default site meta variables. * * @type int $lang_id The language ID. * @type int $blog_public Whether search engines should be discouraged from indexing the site. 1 for true, 0 for false. * } */ $meta = apply_filters( 'add_signup_meta', $meta ); wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid ); confirm_another_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta); return true; } /** * Confirm a new site signup * * @since MU * * @param string $domain The domain URL * @param string $path The site root path * @param string $user_name The username * @param string $user_email The user's email address * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup() */ function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array() ) { ?> <h2><?php printf( __( 'The site %s is yours.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2> <p> <?php printf( __( '<a href="http://%1$s">http://%2$s</a> is your new site. <a href="%3$s">Log in</a> as &#8220;%4$s&#8221; using your existing password.' ), $domain.$path, $domain.$path, "http://" . $domain.$path . "wp-login.php", $user_name ) ?> </p> <?php /** * Fires when the site or user sign-up process is complete. * * @since 3.0.0 */ do_action( 'signup_finished' ); } /** * Setup the new user signup process * * @since MU * * @uses apply_filters() filter $filtered_results * @uses show_user_form() to display the user registration form * @param string $user_name The username * @param string $user_email The user's email * @param array $errors */ function signup_user( $user_name = '', $user_email = '', $errors = '' ) { global $active_signup; if ( !is_wp_error($errors) ) $errors = new WP_Error(); $signup_for = isset( $_POST[ 'signup_for' ] ) ? esc_html( $_POST[ 'signup_for' ] ) : 'blog'; $signup_user_defaults = array( 'user_name' => $user_name, 'user_email' => $user_email, 'errors' => $errors, ); /** * Filter the default user variables used on the user sign-up form. * * @since 3.0.0 * * @param array $signup_user_defaults { * An array of default user variables. * * @type string $user_name The user username. * @type string $user_email The user email address. * @type array $errors An array of possible errors relevant to the sign-up user. * } */ $filtered_results = apply_filters( 'signup_user_init', $signup_user_defaults ); $user_name = $filtered_results['user_name']; $user_email = $filtered_results['user_email']; $errors = $filtered_results['errors']; ?> <h2><?php printf( __( 'Get your own %s account in seconds' ), get_current_site()->site_name ) ?></h2> <form id="setupform" method="post" action="wp-signup.php"> <input type="hidden" name="stage" value="validate-user-signup" /> <?php /** This action is documented in wp-signup.php */ do_action( 'signup_hidden_fields', 'validate-user' ); ?> <?php show_user_form($user_name, $user_email, $errors); ?> <p> <?php if ( $active_signup == 'blog' ) { ?> <input id="signupblog" type="hidden" name="signup_for" value="blog" /> <?php } elseif ( $active_signup == 'user' ) { ?> <input id="signupblog" type="hidden" name="signup_for" value="user" /> <?php } else { ?> <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> /> <label class="checkbox" for="signupblog"><?php _e('Gimme a site!') ?></label> <br /> <input id="signupuser" type="radio" name="signup_for" value="user" <?php checked( $signup_for, 'user' ); ?> /> <label class="checkbox" for="signupuser"><?php _e('Just a username, please.') ?></label> <?php } ?> </p> <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Next') ?>" /></p> </form> <?php } /** * Validate the new user signup * * @since MU * * @uses validate_user_form() to retrieve an array of the user data * @uses wpmu_signup_user() to signup the new user * @uses confirm_user_signup() to confirm the new user signup * @return bool True if new user signup was validated, false if error */ function validate_user_signup() { $result = validate_user_form(); extract($result); if ( $errors->get_error_code() ) { signup_user($user_name, $user_email, $errors); return false; } if ( 'blog' == $_POST['signup_for'] ) { signup_blog($user_name, $user_email); return false; } /** This filter is documented in wp-signup.php */ wpmu_signup_user( $user_name, $user_email, apply_filters( 'add_signup_meta', array() ) ); confirm_user_signup($user_name, $user_email); return true; } /** * New user signup confirmation * * @since MU * * @param string $user_name The username * @param string $user_email The user's email address */ function confirm_user_signup($user_name, $user_email) { ?> <h2><?php printf( __( '%s is your new username' ), $user_name) ?></h2> <p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ) ?></p> <p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ), $user_email ); ?></p> <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p> <?php /** This action is documented in wp-signup.php */ do_action( 'signup_finished' ); } /** * Setup the new site signup * * @since MU * * @uses apply_filters() to filter $filtered_results * @uses show_blog_form() to display the blog signup form * @param string $user_name The username * @param string $user_email The user's email address * @param string $blogname The site name * @param string $blog_title The site title * @param array $errors */ function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') { if ( !is_wp_error($errors) ) $errors = new WP_Error(); $signup_blog_defaults = array( 'user_name' => $user_name, 'user_email' => $user_email, 'blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ); /** * Filter the default site creation variables for the site sign-up form. * * @since 3.0.0 * * @param array $signup_blog_defaults { * An array of default site creation variables. * * @type string $user_name The user username. * @type string $user_email The user email address. * @type string $blogname The blogname. * @type string $blog_title The title of the site. * @type array $errors An array of possible errors relevant to new site creation variables. * } */ $filtered_results = apply_filters( 'signup_blog_init', $signup_blog_defaults ); $user_name = $filtered_results['user_name']; $user_email = $filtered_results['user_email']; $blogname = $filtered_results['blogname']; $blog_title = $filtered_results['blog_title']; $errors = $filtered_results['errors']; if ( empty($blogname) ) $blogname = $user_name; ?> <form id="setupform" method="post" action="wp-signup.php"> <input type="hidden" name="stage" value="validate-blog-signup" /> <input type="hidden" name="user_name" value="<?php echo esc_attr($user_name) ?>" /> <input type="hidden" name="user_email" value="<?php echo esc_attr($user_email) ?>" /> <?php /** This action is documented in wp-signup.php */ do_action( 'signup_hidden_fields', 'validate-site' ); ?> <?php show_blog_form($blogname, $blog_title, $errors); ?> <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Signup') ?>" /></p> </form> <?php } /** * Validate new site signup * * @since MU * * @uses wpmu_validate_user_signup() to retrieve an array of the new user data and errors * @uses wpmu_validate_blog_signup() to retrieve an array of the new site data and errors * @uses apply_filters() to make signup $meta filterable * @uses signup_user() to signup a new user * @uses signup_blog() to signup a the new user to a new site * @return bool True if the site signup was validated, false if error */ function validate_blog_signup() { // Re-validate user info. $result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']); extract($result); if ( $errors->get_error_code() ) { signup_user($user_name, $user_email, $errors); return false; } $result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title']); extract($result); if ( $errors->get_error_code() ) { signup_blog($user_name, $user_email, $blogname, $blog_title, $errors); return false; } $public = (int) $_POST['blog_public']; $meta = array ('lang_id' => 1, 'public' => $public); /** This filter is documented in wp-signup.php */ $meta = apply_filters( 'add_signup_meta', $meta ); wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta); confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta); return true; } /** * New site signup confirmation * * @since MU * * @param string $domain The domain URL * @param string $path The site root path * @param string $blog_title The new site title * @param string $user_name The user's username * @param string $user_email The user's email address * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup() */ function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array() ) { ?> <h2><?php printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2> <p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ) ?></p> <p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ), $user_email) ?></p> <p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p> <h2><?php _e( 'Still waiting for your email?' ); ?></h2> <p> <?php _e( 'If you haven&#8217;t received your email yet, there are a number of things you can do:' ) ?> <ul id="noemail-tips"> <li><p><strong><?php _e( 'Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.' ) ?></strong></p></li> <li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ) ?></p></li> <li><?php printf( __( 'Have you entered your email correctly? You have entered %s, if it&#8217;s incorrect, you will not receive your email.' ), $user_email ) ?></li> </ul> </p> <?php /** This action is documented in wp-signup.php */ do_action( 'signup_finished' ); } // Main $active_signup = get_site_option( 'registration', 'none' ); /** * Filter the type of site sign-up. * * @since 3.0.0 * * @param string $active_signup String that returns registration type. The value can be * 'all', 'none', 'blog', or 'user'. */ $active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // Make the signup type translatable. $i18n_signup['all'] = _x('all', 'Multisite active signup type'); $i18n_signup['none'] = _x('none', 'Multisite active signup type'); $i18n_signup['blog'] = _x('blog', 'Multisite active signup type'); $i18n_signup['user'] = _x('user', 'Multisite active signup type'); if ( is_super_admin() ) echo '<div class="mu_alert">' . sprintf( __( 'Greetings Site Administrator! You are currently allowing &#8220;%s&#8221; registrations. To change or disable registration go to your <a href="%s">Options page</a>.' ), $i18n_signup[$active_signup], esc_url( network_admin_url( 'settings.php' ) ) ) . '</div>'; $newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null; $current_user = wp_get_current_user(); if ( $active_signup == 'none' ) { _e( 'Registration has been disabled.' ); } elseif ( $active_signup == 'blog' && !is_user_logged_in() ) { $login_url = site_url( 'wp-login.php?redirect_to=' . urlencode( network_site_url( 'wp-signup.php' ) ) ); echo sprintf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url ); } else { $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default'; switch ( $stage ) { case 'validate-user-signup' : if ( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' ) validate_user_signup(); else _e( 'User registration has been disabled.' ); break; case 'validate-blog-signup': if ( $active_signup == 'all' || $active_signup == 'blog' ) validate_blog_signup(); else _e( 'Site registration has been disabled.' ); break; case 'gimmeanotherblog': validate_another_blog_signup(); break; case 'default': default : $user_email = isset( $_POST[ 'user_email' ] ) ? $_POST[ 'user_email' ] : ''; /** * Fires when the site sign-up form is sent. * * @since 3.0.0 */ do_action( 'preprocess_signup_form' ); if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) signup_another_blog($newblogname); elseif ( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) ) signup_user( $newblogname, $user_email ); elseif ( is_user_logged_in() == false && ( $active_signup == 'blog' ) ) _e( 'Sorry, new registrations are not allowed at this time.' ); else _e( 'You are logged in already. No need to register again!' ); if ( $newblogname ) { $newblog = get_blogaddress_by_name( $newblogname ); if ( $active_signup == 'blog' || $active_signup == 'all' ) printf( '<p><em>' . __( 'The site you were looking for, <strong>%s</strong>, does not exist, but you can create it now!' ) . '</em></p>', $newblog ); else printf( '<p><em>' . __( 'The site you were looking for, <strong>%s</strong>, does not exist.' ) . '</em></p>', $newblog ); } break; } } ?> </div> </div> <?php /** * Fires after the sign-up forms, before wp_footer. * * @since 3.0.0 */ do_action( 'after_signup_form' ); ?> <?php get_footer(); ?>
01-wordpress-paypal
trunk/wp-signup.php
PHP
gpl3
25,665
<?php /** * Outputs the OPML XML format for getting the links defined in the link * administration. This can be used to export links from one blog over to * another. Links aren't exported by the WordPress export, so this file handles * that. * * This file is not added by default to WordPress theme pages when outputting * feed links. It will have to be added manually for browsers and users to pick * up that this file exists. * * @package WordPress */ require_once( dirname( __FILE__ ) . '/wp-load.php' ); header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); $link_cat = ''; if ( !empty($_GET['link_cat']) ) { $link_cat = $_GET['link_cat']; if ( !in_array($link_cat, array('all', '0')) ) $link_cat = absint( (string)urldecode($link_cat) ); } echo '<?xml version="1.0"?'.">\n"; ?> <opml version="1.0"> <head> <title><?php printf( __('Links for %s'), esc_attr(get_bloginfo('name', 'display')) ); ?></title> <dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated> <?php /** * Fires in the OPML header. * * @since 3.0.0 */ do_action( 'opml_head' ); ?> </head> <body> <?php if ( empty($link_cat) ) $cats = get_categories(array('taxonomy' => 'link_category', 'hierarchical' => 0)); else $cats = get_categories(array('taxonomy' => 'link_category', 'hierarchical' => 0, 'include' => $link_cat)); foreach ( (array)$cats as $cat ) : /** * Filter the OPML outline link category name. * * @since 2.2.0 * * @param string $catname The OPML outline category name. */ $catname = apply_filters( 'link_category', $cat->name ); ?> <outline type="category" title="<?php echo esc_attr($catname); ?>"> <?php $bookmarks = get_bookmarks(array("category" => $cat->term_id)); foreach ( (array)$bookmarks as $bookmark ) : /** * Filter the OPML outline link title text. * * @since 2.2.0 * * @param string $title The OPML outline title text. */ $title = apply_filters( 'link_title', $bookmark->link_name ); ?> <outline text="<?php echo esc_attr($title); ?>" type="link" xmlUrl="<?php echo esc_attr($bookmark->link_rss); ?>" htmlUrl="<?php echo esc_attr($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" /> <?php endforeach; // $bookmarks ?> </outline> <?php endforeach; // $cats ?> </body> </opml>
01-wordpress-paypal
trunk/wp-links-opml.php
PHP
gpl3
2,380
<?php /** * The base configurations of the WordPress. * * This file has the following configurations: MySQL settings, Table Prefix, * Secret Keys, WordPress Language, and ABSPATH. You can find more information * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing * wp-config.php} Codex page. You can get the MySQL settings from your web host. * * This file is used by the wp-config.php creation script during the * installation. You don't have to use the web site, you can just copy this file * to "wp-config.php" and fill in the values. * * @package WordPress */ // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'database_name_here'); /** MySQL database username */ define('DB_USER', 'username_here'); /** MySQL database password */ define('DB_PASSWORD', 'password_here'); /** MySQL hostname */ define('DB_HOST', 'localhost'); /** Database Charset to use in creating database tables. */ define('DB_CHARSET', 'utf8'); /** The Database Collate type. Don't change this if in doubt. */ define('DB_COLLATE', ''); /**#@+ * Authentication Unique Keys and Salts. * * Change these to different unique phrases! * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service} * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again. * * @since 2.6.0 */ define('AUTH_KEY', 'put your unique phrase here'); define('SECURE_AUTH_KEY', 'put your unique phrase here'); define('LOGGED_IN_KEY', 'put your unique phrase here'); define('NONCE_KEY', 'put your unique phrase here'); define('AUTH_SALT', 'put your unique phrase here'); define('SECURE_AUTH_SALT', 'put your unique phrase here'); define('LOGGED_IN_SALT', 'put your unique phrase here'); define('NONCE_SALT', 'put your unique phrase here'); /**#@-*/ /** * WordPress Database Table prefix. * * You can have multiple installations in one database if you give each a unique * prefix. Only numbers, letters, and underscores please! */ $table_prefix = 'wp_'; /** * WordPress Localized Language, defaults to English. * * Change this to localize WordPress. A corresponding MO file for the chosen * language must be installed to wp-content/languages. For example, install * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German * language support. */ define('WPLANG', ''); /** * For developers: WordPress debugging mode. * * Change this to true to enable the display of notices during development. * It is strongly recommended that plugin and theme developers use WP_DEBUG * in their development environments. */ define('WP_DEBUG', false); /* That's all, stop editing! Happy blogging. */ /** Absolute path to the WordPress directory. */ if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); /** Sets up WordPress vars and included files. */ require_once(ABSPATH . 'wp-settings.php');
01-wordpress-paypal
trunk/wp-config-sample.php
PHP
gpl3
3,087
<?php /* Plugin Name: Registration Plugin URI: http://www.techstorm.com Description: Registration Plugin Version: 1 Author: TechStorm Author URI: http://www.techstorm.com */ add_action('register_form', 'registration_register_form'); function registration_register_form() { $first_name = ( isset($_POST['first_name']) ) ? $_POST['first_name'] : ''; ?> <p> <label for="first_name"><?php _e('First name', 'mydomain') ?><br /> <input type="text" name="first_name" id="first_name" class="input" value="<?php echo esc_attr(stripslashes($first_name)); ?>" size="25" /> </label> </p> <?php } add_filter('registation_errors', 'registration_registration_errors', 10, 3); function registration_registration_errors($error, $sanitized_user_login, $user_email) { if (empty($_POST['first_name'])) $errors->add('first_name_error', __('<strong>ERROR</strong>: You must include a first name.', 'mydomain')); return $errors; } //3. Finally, save our extra registration user meta. add_action('user_register', 'myplugin_user_register'); function myplugin_user_register($user_id) { if (isset($_POST['first_name'])) update_user_meta($user_id, 'first_name', $_POST['first_name']); } function HttpPost($postUrl_, $nvpStr_) { $url = $postUrl_; // Set the curl parameters. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); // Set the request as a POST FIELD for curl. curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpStr_); // Get response from the server. $httpResponse = curl_exec($ch); if (!$httpResponse) { exit("$methodName_ failed: " . curl_error($ch) . '(' . curl_errno($ch) . ')'); } curl_close($ch); return $httpResponse; } function request_for_payment($url_, $code_, $rechargeMinutes_, $ref_, $id1_, $id2_) { $encode = urlencode($code_); $recMinutes = urlencode($rechargeMinutes_); $ref = urlencode($ref_); $id1 = urlencode($id1_); $id2 = urlencode($id2_); $nvpStr = "&code=$encode&rechargeMinutes=$recMinutes&ref=$ref&id1=$id1&id2=$id2"; $httpParsedResponseAr = HttpPost($url_, $nvpStr); echo $httpParsedResponseAr; } function wp_new_user_notification($user_id, $plaintext_pass = '') { $user = new WP_User($user_id); $user_login = stripslashes($user->user_login); $user_email = stripslashes($user->user_email); // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $messageAdmin = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n"; $messageAdmin .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; $messageAdmin .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; //wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); if (empty($plaintext_pass)) return; $messageUser = sprintf(__('Registration completely! Below are your login infomation:')) . "\r\n"; $messageUser .= sprintf(__('Username: %s'), $user_login) . "\r\n"; $messageUser .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; $messageUser .= wp_login_url() . "\r\n"; // wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message); $admess = urlencode($messageAdmin); $usmess = urlencode($messageUser); $pw = urlencode($plaintext_pass); $us = urlencode($user_login); $usmail = urlencode($user_email); $admail = urlencode($messageUser); $site_title = urlencode($blogname); $nvpStr = "&us=$us&pw=$pw&usmess=$usmess&admess=$admess&usmail=$usmail&admail=$admail&site_title=$site_title"; $home_url = get_home_url(); $url = $home_url . '/paypal/paypal.php'; $httpParsedResponseAr = HttpPost($url, $nvpStr); echo $httpParsedResponseAr; // wp_redirect('project01/paypal/paypal.php'); // $mail = new \PHPMailer(); // $mail->IsSMTP(); // $mail->SMTPDebug = 0; // $mail->SMTPAuth = 'login'; // $mail->SMTPSecure = 'ssl'; // $mail->Host = 'smtp.gmail.com'; // <- Server email // $mail->Port = 465; // <- Port của server // $mail->Username = 'vietanh.pd1@gmail.com'; // <- Email của người gửi // $mail->Password = 'nguyenthuydan'; // <- Pass của email người gửi // $mail->SetFrom('vietanh.pd1@gmail.com', 'Việt Anh'); // <- Email của người gửi + tên người gửi // $mail->Subject = 'Test'; // <- Tiêu đề email // $mail->Body = 'The content'; // <- Nội dung email // $mail->AddAddress('vietanh.sgu@gmail.com'); // <- Email của người nhận //// $path = "C://RHDSetup.log"; //// $mail->addAttachment($path); // <- $path là đường dẫn tới file cần đính kèm // $mail->Send(); exit; } ?>
01-wordpress-paypal
trunk/registration.php
PHP
gpl3
5,611
<?php /** * Bootstrap file for setting the ABSPATH constant * and loading the wp-config.php file. The wp-config.php * file will then load the wp-settings.php file, which * will then set up the WordPress environment. * * If the wp-config.php file is not found then an error * will be displayed asking the visitor to set up the * wp-config.php file. * * Will also search for wp-config.php in WordPress' parent * directory to allow the WordPress directory to remain * untouched. * * @internal This file must be parsable by PHP4. * * @package WordPress */ /** Define ABSPATH as this file's directory */ define( 'ABSPATH', dirname(__FILE__) . '/' ); error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); if ( file_exists( ABSPATH . 'wp-config.php') ) { /** The config file resides in ABSPATH */ require_once( ABSPATH . 'wp-config.php' ); } elseif ( file_exists( dirname(ABSPATH) . '/wp-config.php' ) && ! file_exists( dirname(ABSPATH) . '/wp-settings.php' ) ) { /** The config file resides one level above ABSPATH but is not part of another install */ require_once( dirname(ABSPATH) . '/wp-config.php' ); } else { // A config file doesn't exist define( 'WPINC', 'wp-includes' ); define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); require_once( ABSPATH . WPINC . '/load.php' ); require_once( ABSPATH . WPINC . '/version.php' ); wp_check_php_mysql_versions(); wp_load_translations_early(); // Standardize $_SERVER variables across setups. wp_fix_server_vars(); require_once( ABSPATH . WPINC . '/functions.php' ); $path = wp_guess_url() . '/wp-admin/setup-config.php'; // Die with an error message $die = __( "There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started." ) . '</p>'; $die .= '<p>' . __( "Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ) . '</p>'; $die .= '<p>' . __( "You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file." ) . '</p>'; $die .= '<p><a href="' . $path . '" class="button button-large">' . __( "Create a Configuration File" ) . '</a>'; wp_die( $die, __( 'WordPress &rsaquo; Error' ) ); }
01-wordpress-paypal
trunk/wp-load.php
PHP
gpl3
2,359
<?php /** * The custom background script. * * @package WordPress * @subpackage Administration */ /** * The custom background class. * * @since 3.0.0 * @package WordPress * @subpackage Administration */ class Custom_Background { /** * Callback for administration header. * * @var callback * @since 3.0.0 * @access private */ var $admin_header_callback; /** * Callback for header div. * * @var callback * @since 3.0.0 * @access private */ var $admin_image_div_callback; /** * Holds the page menu hook. * * @var string * @since 3.0.0 * @access private */ var $page = ''; /** * Constructor - Register administration header callback. * * @since 3.0.0 * @param callback $admin_header_callback * @param callback $admin_image_div_callback Optional custom image div output callback. * @return Custom_Background */ function __construct($admin_header_callback = '', $admin_image_div_callback = '') { $this->admin_header_callback = $admin_header_callback; $this->admin_image_div_callback = $admin_image_div_callback; add_action( 'admin_menu', array( $this, 'init' ) ); add_action( 'wp_ajax_set-background-image', array( $this, 'wp_set_background_image' ) ); } /** * Set up the hooks for the Custom Background admin page. * * @since 3.0.0 */ function init() { if ( ! current_user_can('edit_theme_options') ) return; $this->page = $page = add_theme_page(__('Background'), __('Background'), 'edit_theme_options', 'custom-background', array($this, 'admin_page')); add_action("load-$page", array($this, 'admin_load')); add_action("load-$page", array($this, 'take_action'), 49); add_action("load-$page", array($this, 'handle_upload'), 49); if ( $this->admin_header_callback ) add_action("admin_head-$page", $this->admin_header_callback, 51); } /** * Set up the enqueue for the CSS & JavaScript files. * * @since 3.0.0 */ function admin_load() { get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __( 'You can customize the look of your site without touching any of your theme&#8217;s code by using a custom background. Your background can be an image or a color.' ) . '</p>' . '<p>' . __( 'To use a background image, simply upload it or choose an image that has already been uploaded to your Media Library by clicking the &#8220;Choose Image&#8221; button. You can display a single instance of your image, or tile it to fill the screen. You can have your background fixed in place, so your site content moves on top of it, or you can have it scroll with your site.' ) . '</p>' . '<p>' . __( 'You can also choose a background color by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. &#8220;#ff0000&#8221; for red, or by choosing a color using the color picker.' ) . '</p>' . '<p>' . __( 'Don&#8217;t forget to click on the Save Changes button when you are finished.' ) . '</p>' ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . '<p>' . __( '<a href="http://codex.wordpress.org/Appearance_Background_Screen" target="_blank">Documentation on Custom Background</a>' ) . '</p>' . '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' ); wp_enqueue_media(); wp_enqueue_script('custom-background'); wp_enqueue_style('wp-color-picker'); } /** * Execute custom background modification. * * @since 3.0.0 */ function take_action() { if ( empty($_POST) ) return; if ( isset($_POST['reset-background']) ) { check_admin_referer('custom-background-reset', '_wpnonce-custom-background-reset'); remove_theme_mod('background_image'); remove_theme_mod('background_image_thumb'); $this->updated = true; return; } if ( isset($_POST['remove-background']) ) { // @TODO: Uploaded files are not removed here. check_admin_referer('custom-background-remove', '_wpnonce-custom-background-remove'); set_theme_mod('background_image', ''); set_theme_mod('background_image_thumb', ''); $this->updated = true; wp_safe_redirect( $_POST['_wp_http_referer'] ); return; } if ( isset($_POST['background-repeat']) ) { check_admin_referer('custom-background'); if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat', 'repeat-x', 'repeat-y')) ) $repeat = $_POST['background-repeat']; else $repeat = 'repeat'; set_theme_mod('background_repeat', $repeat); } if ( isset($_POST['background-position-x']) ) { check_admin_referer('custom-background'); if ( in_array($_POST['background-position-x'], array('center', 'right', 'left')) ) $position = $_POST['background-position-x']; else $position = 'left'; set_theme_mod('background_position_x', $position); } if ( isset($_POST['background-attachment']) ) { check_admin_referer('custom-background'); if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) ) $attachment = $_POST['background-attachment']; else $attachment = 'fixed'; set_theme_mod('background_attachment', $attachment); } if ( isset($_POST['background-color']) ) { check_admin_referer('custom-background'); $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['background-color']); if ( strlen($color) == 6 || strlen($color) == 3 ) set_theme_mod('background_color', $color); else set_theme_mod('background_color', ''); } $this->updated = true; } /** * Display the custom background page. * * @since 3.0.0 */ function admin_page() { ?> <div class="wrap" id="custom-background"> <h2><?php _e( 'Custom Background' ); ?></h2> <?php if ( ! empty( $this->updated ) ) { ?> <div id="message" class="updated"> <p><?php printf( __( 'Background updated. <a href="%s">Visit your site</a> to see how it looks.' ), home_url( '/' ) ); ?></p> </div> <?php } ?> <h3><?php _e( 'Background Image' ); ?></h3> <table class="form-table"> <tbody> <tr> <th scope="row"><?php _e( 'Preview' ); ?></th> <td> <?php if ( $this->admin_image_div_callback ) { call_user_func( $this->admin_image_div_callback ); } else { $background_styles = ''; if ( $bgcolor = get_background_color() ) $background_styles .= 'background-color: #' . $bgcolor . ';'; if ( get_background_image() ) { $background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', get_background_image() ) ) ) ); // background-image URL must be single quote, see below $background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');' . ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) . ';' . ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ); } ?> <div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?> <?php if ( get_background_image() ) { ?> <img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" /><br /> <img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" /> <?php } ?> </div> <?php } ?> </td> </tr> <?php if ( get_background_image() ) : ?> <tr> <th scope="row"><?php _e('Remove Image'); ?></th> <td> <form method="post" action=""> <?php wp_nonce_field('custom-background-remove', '_wpnonce-custom-background-remove'); ?> <?php submit_button( __( 'Remove Background Image' ), 'button', 'remove-background', false ); ?><br/> <?php _e('This will remove the background image. You will not be able to restore any customizations.') ?> </form> </td> </tr> <?php endif; ?> <?php $default_image = get_theme_support( 'custom-background', 'default-image' ); ?> <?php if ( $default_image && get_background_image() != $default_image ) : ?> <tr> <th scope="row"><?php _e('Restore Original Image'); ?></th> <td> <form method="post" action=""> <?php wp_nonce_field('custom-background-reset', '_wpnonce-custom-background-reset'); ?> <?php submit_button( __( 'Restore Original Image' ), 'button', 'reset-background', false ); ?><br/> <?php _e('This will restore the original background image. You will not be able to restore any customizations.') ?> </form> </td> </tr> <?php endif; ?> <tr> <th scope="row"><?php _e('Select Image'); ?></th> <td><form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post" action=""> <p> <label for="upload"><?php _e( 'Choose an image from your computer:' ); ?></label><br /> <input type="file" id="upload" name="import" /> <input type="hidden" name="action" value="save" /> <?php wp_nonce_field( 'custom-background-upload', '_wpnonce-custom-background-upload' ); ?> <?php submit_button( __( 'Upload' ), 'button', 'submit', false ); ?> </p> <p> <label for="choose-from-library-link"><?php _e( 'Or choose an image from your media library:' ); ?></label><br /> <a id="choose-from-library-link" class="button" data-choose="<?php esc_attr_e( 'Choose a Background Image' ); ?>" data-update="<?php esc_attr_e( 'Set as background' ); ?>"><?php _e( 'Choose Image' ); ?></a> </p> </form> </td> </tr> </tbody> </table> <h3><?php _e('Display Options') ?></h3> <form method="post" action=""> <table class="form-table"> <tbody> <?php if ( get_background_image() ) : ?> <tr> <th scope="row"><?php _e( 'Position' ); ?></th> <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend> <label> <input name="background-position-x" type="radio" value="left"<?php checked( 'left', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> /> <?php _e('Left') ?> </label> <label> <input name="background-position-x" type="radio" value="center"<?php checked( 'center', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> /> <?php _e('Center') ?> </label> <label> <input name="background-position-x" type="radio" value="right"<?php checked( 'right', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> /> <?php _e('Right') ?> </label> </fieldset></td> </tr> <tr> <th scope="row"><?php _e( 'Repeat' ); ?></th> <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Repeat' ); ?></span></legend> <label><input type="radio" name="background-repeat" value="no-repeat"<?php checked( 'no-repeat', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('No Repeat'); ?></label> <label><input type="radio" name="background-repeat" value="repeat"<?php checked( 'repeat', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile'); ?></label> <label><input type="radio" name="background-repeat" value="repeat-x"<?php checked( 'repeat-x', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile Horizontally'); ?></label> <label><input type="radio" name="background-repeat" value="repeat-y"<?php checked( 'repeat-y', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile Vertically'); ?></label> </fieldset></td> </tr> <tr> <th scope="row"><?php _ex( 'Attachment', 'Background Attachment' ); ?></th> <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Attachment' ); ?></span></legend> <label> <input name="background-attachment" type="radio" value="scroll" <?php checked( 'scroll', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) ) ); ?> /> <?php _e( 'Scroll' ); ?> </label> <label> <input name="background-attachment" type="radio" value="fixed" <?php checked( 'fixed', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) ) ); ?> /> <?php _e( 'Fixed' ); ?> </label> </fieldset></td> </tr> <?php endif; // get_background_image() ?> <tr> <th scope="row"><?php _e( 'Background Color' ); ?></th> <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Color' ); ?></span></legend> <?php $default_color = ''; if ( current_theme_supports( 'custom-background', 'default-color' ) ) $default_color = ' data-default-color="#' . esc_attr( get_theme_support( 'custom-background', 'default-color' ) ) . '"'; ?> <input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr( get_background_color() ); ?>"<?php echo $default_color ?> /> </fieldset></td> </tr> </tbody> </table> <?php wp_nonce_field('custom-background'); ?> <?php submit_button( null, 'primary', 'save-background-options' ); ?> </form> </div> <?php } /** * Handle an Image upload for the background image. * * @since 3.0.0 */ function handle_upload() { if ( empty($_FILES) ) return; check_admin_referer('custom-background-upload', '_wpnonce-custom-background-upload'); $overrides = array('test_form' => false); $uploaded_file = $_FILES['import']; $wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'], false ); if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) ); $file = wp_handle_upload($uploaded_file, $overrides); if ( isset($file['error']) ) wp_die( $file['error'] ); $url = $file['url']; $type = $file['type']; $file = $file['file']; $filename = basename($file); // Construct the object array $object = array( 'post_title' => $filename, 'post_content' => $url, 'post_mime_type' => $type, 'guid' => $url, 'context' => 'custom-background' ); // Save the data $id = wp_insert_attachment($object, $file); // Add the meta-data wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); update_post_meta( $id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) ); set_theme_mod('background_image', esc_url_raw($url)); $thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' ); set_theme_mod('background_image_thumb', esc_url_raw( $thumbnail[0] ) ); /** This action is documented in wp-admin/custom-header.php */ do_action( 'wp_create_file_in_uploads', $file, $id ); // For replication $this->updated = true; } /** * Unused since 3.5.0. * * @since 3.4.0 */ function attachment_fields_to_edit( $form_fields ) { return $form_fields; } /** * Unused since 3.5.0. * * @since 3.4.0 */ function filter_upload_tabs( $tabs ) { return $tabs; } public function wp_set_background_image() { if ( ! current_user_can('edit_theme_options') || ! isset( $_POST['attachment_id'] ) ) exit; $attachment_id = absint($_POST['attachment_id']); /** This filter is documented in wp-admin/includes/media.php */ $sizes = array_keys(apply_filters( 'image_size_names_choose', array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size')) )); $size = 'thumbnail'; if ( in_array( $_POST['size'], $sizes ) ) $size = esc_attr( $_POST['size'] ); update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) ); $url = wp_get_attachment_image_src( $attachment_id, $size ); $thumbnail = wp_get_attachment_image_src( $attachment_id, 'thumbnail' ); set_theme_mod( 'background_image', esc_url_raw( $url[0] ) ); set_theme_mod( 'background_image_thumb', esc_url_raw( $thumbnail[0] ) ); exit; } }
01-wordpress-paypal
trunk/wp-admin/custom-background.php
PHP
gpl3
15,910
<?php /** * WordPress Upgrade Functions. Old file, must not be used. Include * wp-admin/includes/upgrade.php instead. * * @deprecated 2.5.0 * @package WordPress * @subpackage Administration */ _deprecated_file( basename(__FILE__), '2.5', 'wp-admin/includes/upgrade.php' ); require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
01-wordpress-paypal
trunk/wp-admin/upgrade-functions.php
PHP
gpl3
338
<?php /** * The custom header image script. * * @package WordPress * @subpackage Administration */ /** * The custom header image class. * * @since 2.1.0 * @package WordPress * @subpackage Administration */ class Custom_Image_Header { /** * Callback for administration header. * * @var callback * @since 2.1.0 * @access private */ var $admin_header_callback; /** * Callback for header div. * * @var callback * @since 3.0.0 * @access private */ var $admin_image_div_callback; /** * Holds default headers. * * @var array * @since 3.0.0 * @access private */ var $default_headers; /** * Holds custom headers uploaded by the user. * * @var array * @since 3.2.0 * @access private */ var $uploaded_headers = array(); /** * Holds the page menu hook. * * @var string * @since 3.0.0 * @access private */ var $page = ''; /** * Constructor - Register administration header callback. * * @since 2.1.0 * @param callback $admin_header_callback * @param callback $admin_image_div_callback Optional custom image div output callback. * @return Custom_Image_Header */ function __construct($admin_header_callback, $admin_image_div_callback = '') { $this->admin_header_callback = $admin_header_callback; $this->admin_image_div_callback = $admin_image_div_callback; add_action( 'admin_menu', array( $this, 'init' ) ); add_action( 'customize_save_after', array( $this, 'customize_set_last_used' ) ); add_action( 'wp_ajax_custom-header-crop', array( $this, 'ajax_header_crop' ) ); add_action( 'wp_ajax_custom-header-add', array( $this, 'ajax_header_add' ) ); add_action( 'wp_ajax_custom-header-remove', array( $this, 'ajax_header_remove' ) ); } /** * Set up the hooks for the Custom Header admin page. * * @since 2.1.0 */ function init() { if ( ! current_user_can('edit_theme_options') ) return; $this->page = $page = add_theme_page(__('Header'), __('Header'), 'edit_theme_options', 'custom-header', array($this, 'admin_page')); add_action("admin_print_scripts-$page", array($this, 'js_includes')); add_action("admin_print_styles-$page", array($this, 'css_includes')); add_action("admin_head-$page", array($this, 'help') ); add_action("admin_head-$page", array($this, 'take_action'), 50); add_action("admin_head-$page", array($this, 'js'), 50); if ( $this->admin_header_callback ) add_action("admin_head-$page", $this->admin_header_callback, 51); } /** * Adds contextual help. * * @since 3.0.0 */ function help() { get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __( 'This screen is used to customize the header section of your theme.') . '</p>' . '<p>' . __( 'You can choose from the theme&#8217;s default header images, or use one of your own. You can also customize how your Site Title and Tagline are displayed.') . '<p>' ) ); get_current_screen()->add_help_tab( array( 'id' => 'set-header-image', 'title' => __('Header Image'), 'content' => '<p>' . __( 'You can set a custom image header for your site. Simply upload the image and crop it, and the new header will go live immediately. Alternatively, you can use an image that has already been uploaded to your Media Library by clicking the &#8220;Choose Image&#8221; button.' ) . '</p>' . '<p>' . __( 'Some themes come with additional header images bundled. If you see multiple images displayed, select the one you&#8217;d like and click the &#8220;Save Changes&#8221; button.' ) . '</p>' . '<p>' . __( 'If your theme has more than one default header image, or you have uploaded more than one custom header image, you have the option of having WordPress display a randomly different image on each page of your site. Click the &#8220;Random&#8221; radio button next to the Uploaded Images or Default Images section to enable this feature.') . '</p>' . '<p>' . __( 'If you don&#8217;t want a header image to be displayed on your site at all, click the &#8220;Remove Header Image&#8221; button at the bottom of the Header Image section of this page. If you want to re-enable the header image later, you just have to select one of the other image options and click &#8220;Save Changes&#8221;.') . '</p>' ) ); get_current_screen()->add_help_tab( array( 'id' => 'set-header-text', 'title' => __('Header Text'), 'content' => '<p>' . sprintf( __( 'For most themes, the header text is your Site Title and Tagline, as defined in the <a href="%1$s">General Settings</a> section.' ), admin_url( 'options-general.php' ) ) . '<p>' . '<p>' . __( 'In the Header Text section of this page, you can choose whether to display this text or hide it. You can also choose a color for the text by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. &#8220;#ff0000&#8221; for red, or by choosing a color using the color picker.' ) . '</p>' . '<p>' . __( 'Don&#8217;t forget to click &#8220;Save Changes&#8221; when you&#8217;re done!') . '</p>' ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . '<p>' . __( '<a href="http://codex.wordpress.org/Appearance_Header_Screen" target="_blank">Documentation on Custom Header</a>' ) . '</p>' . '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' ); } /** * Get the current step. * * @since 2.6.0 * * @return int Current step */ function step() { if ( ! isset( $_GET['step'] ) ) return 1; $step = (int) $_GET['step']; if ( $step < 1 || 3 < $step || ( 2 == $step && ! wp_verify_nonce( $_REQUEST['_wpnonce-custom-header-upload'], 'custom-header-upload' ) ) || ( 3 == $step && ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'custom-header-crop-image' ) ) ) return 1; return $step; } /** * Set up the enqueue for the JavaScript files. * * @since 2.1.0 */ function js_includes() { $step = $this->step(); if ( ( 1 == $step || 3 == $step ) ) { wp_enqueue_media(); wp_enqueue_script( 'custom-header' ); if ( current_theme_supports( 'custom-header', 'header-text' ) ) wp_enqueue_script( 'wp-color-picker' ); } elseif ( 2 == $step ) { wp_enqueue_script('imgareaselect'); } } /** * Set up the enqueue for the CSS files * * @since 2.7.0 */ function css_includes() { $step = $this->step(); if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) wp_enqueue_style( 'wp-color-picker' ); elseif ( 2 == $step ) wp_enqueue_style('imgareaselect'); } /** * Execute custom header modification. * * @since 2.6.0 */ function take_action() { if ( ! current_user_can('edit_theme_options') ) return; if ( empty( $_POST ) ) return; $this->updated = true; if ( isset( $_POST['resetheader'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $this->reset_header_image(); return; } if ( isset( $_POST['removeheader'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $this->remove_header_image(); return; } if ( isset( $_POST['text-color'] ) && ! isset( $_POST['display-header-text'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); set_theme_mod( 'header_textcolor', 'blank' ); } elseif ( isset( $_POST['text-color'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $_POST['text-color'] = str_replace( '#', '', $_POST['text-color'] ); $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['text-color']); if ( strlen($color) == 6 || strlen($color) == 3 ) set_theme_mod('header_textcolor', $color); elseif ( ! $color ) set_theme_mod( 'header_textcolor', 'blank' ); } if ( isset( $_POST['default-header'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $this->set_header_image( $_POST['default-header'] ); return; } } /** * Process the default headers * * @since 3.0.0 */ function process_default_headers() { global $_wp_default_headers; if ( !empty($this->headers) ) return; if ( !isset($_wp_default_headers) ) return; if ( is_array( $this->default_headers ) ) { return; } $this->default_headers = $_wp_default_headers; $template_directory_uri = get_template_directory_uri(); $stylesheet_directory_uri = get_stylesheet_directory_uri(); foreach ( array_keys($this->default_headers) as $header ) { $this->default_headers[$header]['url'] = sprintf( $this->default_headers[$header]['url'], $template_directory_uri, $stylesheet_directory_uri ); $this->default_headers[$header]['thumbnail_url'] = sprintf( $this->default_headers[$header]['thumbnail_url'], $template_directory_uri, $stylesheet_directory_uri ); } } /** * Display UI for selecting one of several default headers. * * Show the random image option if this theme has multiple header images. * Random image option is on by default if no header has been set. * * @since 3.0.0 */ function show_header_selector( $type = 'default' ) { if ( 'default' == $type ) { $headers = $this->default_headers; } else { $headers = get_uploaded_header_images(); $type = 'uploaded'; } if ( 1 < count( $headers ) ) { echo '<div class="random-header">'; echo '<label><input name="default-header" type="radio" value="random-' . $type . '-image"' . checked( is_random_header_image( $type ), true, false ) . ' />'; echo __( '<strong>Random:</strong> Show a different image on each page.' ); echo '</label>'; echo '</div>'; } echo '<div class="available-headers">'; foreach ( $headers as $header_key => $header ) { $header_thumbnail = $header['thumbnail_url']; $header_url = $header['url']; $header_desc = empty( $header['description'] ) ? '' : $header['description']; echo '<div class="default-header">'; echo '<label><input name="default-header" type="radio" value="' . esc_attr( $header_key ) . '" ' . checked( $header_url, get_theme_mod( 'header_image' ), false ) . ' />'; $width = ''; if ( !empty( $header['attachment_id'] ) ) $width = ' width="230"'; echo '<img src="' . set_url_scheme( $header_thumbnail ) . '" alt="' . esc_attr( $header_desc ) .'" title="' . esc_attr( $header_desc ) . '"' . $width . ' /></label>'; echo '</div>'; } echo '<div class="clear"></div></div>'; } /** * Execute Javascript depending on step. * * @since 2.1.0 */ function js() { $step = $this->step(); if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) $this->js_1(); elseif ( 2 == $step ) $this->js_2(); } /** * Display Javascript based on Step 1 and 3. * * @since 2.6.0 */ function js_1() { ?> <script type="text/javascript"> /* <![CDATA[ */ (function($){ var default_color = '#<?php echo get_theme_support( 'custom-header', 'default-text-color' ); ?>', header_text_fields; function pickColor(color) { $('#name').css('color', color); $('#desc').css('color', color); $('#text-color').val(color); } function toggle_text() { var checked = $('#display-header-text').prop('checked'), text_color; header_text_fields.toggle( checked ); if ( ! checked ) return; text_color = $('#text-color'); if ( '' == text_color.val().replace('#', '') ) { text_color.val( default_color ); pickColor( default_color ); } else { pickColor( text_color.val() ); } } $(document).ready(function() { var text_color = $('#text-color'); header_text_fields = $('.displaying-header-text'); text_color.wpColorPicker({ change: function( event, ui ) { pickColor( text_color.wpColorPicker('color') ); }, clear: function() { pickColor( '' ); } }); $('#display-header-text').click( toggle_text ); <?php if ( ! display_header_text() ) : ?> toggle_text(); <?php endif; ?> }); })(jQuery); /* ]]> */ </script> <?php } /** * Display Javascript based on Step 2. * * @since 2.6.0 */ function js_2() { ?> <script type="text/javascript"> /* <![CDATA[ */ function onEndCrop( coords ) { jQuery( '#x1' ).val(coords.x); jQuery( '#y1' ).val(coords.y); jQuery( '#width' ).val(coords.w); jQuery( '#height' ).val(coords.h); } jQuery(document).ready(function() { var xinit = <?php echo absint( get_theme_support( 'custom-header', 'width' ) ); ?>; var yinit = <?php echo absint( get_theme_support( 'custom-header', 'height' ) ); ?>; var ratio = xinit / yinit; var ximg = jQuery('img#upload').width(); var yimg = jQuery('img#upload').height(); if ( yimg < yinit || ximg < xinit ) { if ( ximg / yimg > ratio ) { yinit = yimg; xinit = yinit * ratio; } else { xinit = ximg; yinit = xinit / ratio; } } jQuery('img#upload').imgAreaSelect({ handles: true, keys: true, show: true, x1: 0, y1: 0, x2: xinit, y2: yinit, <?php if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) ) { ?> aspectRatio: xinit + ':' + yinit, <?php } if ( ! current_theme_supports( 'custom-header', 'flex-height' ) ) { ?> maxHeight: <?php echo get_theme_support( 'custom-header', 'height' ); ?>, <?php } if ( ! current_theme_supports( 'custom-header', 'flex-width' ) ) { ?> maxWidth: <?php echo get_theme_support( 'custom-header', 'width' ); ?>, <?php } ?> onInit: function () { jQuery('#width').val(xinit); jQuery('#height').val(yinit); }, onSelectChange: function(img, c) { jQuery('#x1').val(c.x1); jQuery('#y1').val(c.y1); jQuery('#width').val(c.width); jQuery('#height').val(c.height); } }); }); /* ]]> */ </script> <?php } /** * Display first step of custom header image page. * * @since 2.1.0 */ function step_1() { $this->process_default_headers(); ?> <div class="wrap"> <h2><?php _e( 'Custom Header' ); ?></h2> <?php if ( ! empty( $this->updated ) ) { ?> <div id="message" class="updated"> <p><?php printf( __( 'Header updated. <a href="%s">Visit your site</a> to see how it looks.' ), home_url( '/' ) ); ?></p> </div> <?php } ?> <h3><?php _e( 'Header Image' ); ?></h3> <table class="form-table"> <tbody> <?php if ( get_custom_header() || display_header_text() ) : ?> <tr> <th scope="row"><?php _e( 'Preview' ); ?></th> <td> <?php if ( $this->admin_image_div_callback ) { call_user_func( $this->admin_image_div_callback ); } else { $custom_header = get_custom_header(); $header_image_style = 'background-image:url(' . esc_url( get_header_image() ) . ');'; if ( $custom_header->width ) $header_image_style .= 'max-width:' . $custom_header->width . 'px;'; if ( $custom_header->height ) $header_image_style .= 'height:' . $custom_header->height . 'px;'; ?> <div id="headimg" style="<?php echo $header_image_style; ?>"> <?php if ( display_header_text() ) $style = ' style="color:#' . get_header_textcolor() . ';"'; else $style = ' style="display:none;"'; ?> <h1><a id="name" class="displaying-header-text" <?php echo $style; ?> onclick="return false;" href="<?php bloginfo('url'); ?>"><?php bloginfo( 'name' ); ?></a></h1> <div id="desc" class="displaying-header-text" <?php echo $style; ?>><?php bloginfo( 'description' ); ?></div> </div> <?php } ?> </td> </tr> <?php endif; ?> <?php if ( current_theme_supports( 'custom-header', 'uploads' ) ) : ?> <tr> <th scope="row"><?php _e( 'Select Image' ); ?></th> <td> <p><?php _e( 'You can select an image to be shown at the top of your site by uploading from your computer or choosing from your media library. After selecting an image you will be able to crop it.' ); ?><br /> <?php if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) ) { printf( __( 'Images of exactly <strong>%1$d &times; %2$d pixels</strong> will be used as-is.' ) . '<br />', get_theme_support( 'custom-header', 'width' ), get_theme_support( 'custom-header', 'height' ) ); } elseif ( current_theme_supports( 'custom-header', 'flex-height' ) ) { if ( ! current_theme_supports( 'custom-header', 'flex-width' ) ) printf( __( 'Images should be at least <strong>%1$d pixels</strong> wide.' ) . ' ', get_theme_support( 'custom-header', 'width' ) ); } elseif ( current_theme_supports( 'custom-header', 'flex-width' ) ) { if ( ! current_theme_supports( 'custom-header', 'flex-height' ) ) printf( __( 'Images should be at least <strong>%1$d pixels</strong> tall.' ) . ' ', get_theme_support( 'custom-header', 'height' ) ); } if ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) { if ( current_theme_supports( 'custom-header', 'width' ) ) printf( __( 'Suggested width is <strong>%1$d pixels</strong>.' ) . ' ', get_theme_support( 'custom-header', 'width' ) ); if ( current_theme_supports( 'custom-header', 'height' ) ) printf( __( 'Suggested height is <strong>%1$d pixels</strong>.' ) . ' ', get_theme_support( 'custom-header', 'height' ) ); } ?></p> <form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post" action="<?php echo esc_url( add_query_arg( 'step', 2 ) ) ?>"> <p> <label for="upload"><?php _e( 'Choose an image from your computer:' ); ?></label><br /> <input type="file" id="upload" name="import" /> <input type="hidden" name="action" value="save" /> <?php wp_nonce_field( 'custom-header-upload', '_wpnonce-custom-header-upload' ); ?> <?php submit_button( __( 'Upload' ), 'button', 'submit', false ); ?> </p> <?php $modal_update_href = esc_url( add_query_arg( array( 'page' => 'custom-header', 'step' => 2, '_wpnonce-custom-header-upload' => wp_create_nonce('custom-header-upload'), ), admin_url('themes.php') ) ); ?> <p> <label for="choose-from-library-link"><?php _e( 'Or choose an image from your media library:' ); ?></label><br /> <a id="choose-from-library-link" class="button" data-update-link="<?php echo esc_attr( $modal_update_href ); ?>" data-choose="<?php esc_attr_e( 'Choose a Custom Header' ); ?>" data-update="<?php esc_attr_e( 'Set as header' ); ?>"><?php _e( 'Choose Image' ); ?></a> </p> </form> </td> </tr> <?php endif; ?> </tbody> </table> <form method="post" action="<?php echo esc_url( add_query_arg( 'step', 1 ) ) ?>"> <table class="form-table"> <tbody> <?php if ( get_uploaded_header_images() ) : ?> <tr> <th scope="row"><?php _e( 'Uploaded Images' ); ?></th> <td> <p><?php _e( 'You can choose one of your previously uploaded headers, or show a random one.' ) ?></p> <?php $this->show_header_selector( 'uploaded' ); ?> </td> </tr> <?php endif; if ( ! empty( $this->default_headers ) ) : ?> <tr> <th scope="row"><?php _e( 'Default Images' ); ?></th> <td> <?php if ( current_theme_supports( 'custom-header', 'uploads' ) ) : ?> <p><?php _e( 'If you don&lsquo;t want to upload your own image, you can use one of these cool headers, or show a random one.' ) ?></p> <?php else: ?> <p><?php _e( 'You can use one of these cool headers or show a random one on each page.' ) ?></p> <?php endif; ?> <?php $this->show_header_selector( 'default' ); ?> </td> </tr> <?php endif; if ( get_header_image() ) : ?> <tr> <th scope="row"><?php _e( 'Remove Image' ); ?></th> <td> <p><?php _e( 'This will remove the header image. You will not be able to restore any customizations.' ) ?></p> <?php submit_button( __( 'Remove Header Image' ), 'button', 'removeheader', false ); ?> </td> </tr> <?php endif; $default_image = get_theme_support( 'custom-header', 'default-image' ); if ( $default_image && get_header_image() != $default_image ) : ?> <tr> <th scope="row"><?php _e( 'Reset Image' ); ?></th> <td> <p><?php _e( 'This will restore the original header image. You will not be able to restore any customizations.' ) ?></p> <?php submit_button( __( 'Restore Original Header Image' ), 'button', 'resetheader', false ); ?> </td> </tr> <?php endif; ?> </tbody> </table> <?php if ( current_theme_supports( 'custom-header', 'header-text' ) ) : ?> <h3><?php _e( 'Header Text' ); ?></h3> <table class="form-table"> <tbody> <tr> <th scope="row"><?php _e( 'Header Text' ); ?></th> <td> <p> <label><input type="checkbox" name="display-header-text" id="display-header-text"<?php checked( display_header_text() ); ?> /> <?php _e( 'Show header text with your image.' ); ?></label> </p> </td> </tr> <tr class="displaying-header-text"> <th scope="row"><?php _e( 'Text Color' ); ?></th> <td> <p> <?php $header_textcolor = display_header_text() ? get_header_textcolor() : get_theme_support( 'custom-header', 'default-text-color' ); $default_color = ''; if ( current_theme_supports( 'custom-header', 'default-text-color' ) ) { $default_color = '#' . get_theme_support( 'custom-header', 'default-text-color' ); $default_color_attr = ' data-default-color="' . esc_attr( $default_color ) . '"'; echo '<input type="text" name="text-color" id="text-color" value="#' . esc_attr( $header_textcolor ) . '"' . $default_color_attr . ' />'; if ( $default_color ) echo ' <span class="description hide-if-js">' . sprintf( _x( 'Default: %s', 'color' ), $default_color ) . '</span>'; } ?> </p> </td> </tr> </tbody> </table> <?php endif; /** * Fires just before the submit button in the custom header options form. * * @since 3.1.0 */ do_action( 'custom_header_options' ); wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?> <?php submit_button( null, 'primary', 'save-header-options' ); ?> </form> </div> <?php } /** * Display second step of custom header image page. * * @since 2.1.0 */ function step_2() { check_admin_referer('custom-header-upload', '_wpnonce-custom-header-upload'); if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) wp_die( __( 'Cheatin&#8217; uh?' ) ); if ( empty( $_POST ) && isset( $_GET['file'] ) ) { $attachment_id = absint( $_GET['file'] ); $file = get_attached_file( $attachment_id, true ); $url = wp_get_attachment_image_src( $attachment_id, 'full'); $url = $url[0]; } elseif ( isset( $_POST ) ) { extract($this->step_2_manage_upload()); } if ( file_exists( $file ) ) { list( $width, $height, $type, $attr ) = getimagesize( $file ); } else { $data = wp_get_attachment_metadata( $attachment_id ); $height = isset( $data[ 'height' ] ) ? $data[ 'height' ] : 0; $width = isset( $data[ 'width' ] ) ? $data[ 'width' ] : 0; unset( $data ); } $max_width = 0; // For flex, limit size of image displayed to 1500px unless theme says otherwise if ( current_theme_supports( 'custom-header', 'flex-width' ) ) $max_width = 1500; if ( current_theme_supports( 'custom-header', 'max-width' ) ) $max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) ); $max_width = max( $max_width, get_theme_support( 'custom-header', 'width' ) ); // If flexible height isn't supported and the image is the exact right size if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) && $width == get_theme_support( 'custom-header', 'width' ) && $height == get_theme_support( 'custom-header', 'height' ) ) { // Add the meta-data if ( file_exists( $file ) ) wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); $this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) ); /** * Fires after the header image is set or an error is returned. * * @since 2.1.0 * * @param string $file Path to the file. * @param int $attachment_id Attachment ID. */ do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication return $this->finished(); } elseif ( $width > $max_width ) { $oitar = $width / $max_width; $image = wp_crop_image($attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file)); if ( ! $image || is_wp_error( $image ) ) wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); /** This filter is documented in wp-admin/custom-header.php */ $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication $url = str_replace(basename($url), basename($image), $url); $width = $width / $oitar; $height = $height / $oitar; } else { $oitar = 1; } ?> <div class="wrap"> <h2><?php _e( 'Crop Header Image' ); ?></h2> <form method="post" action="<?php echo esc_url(add_query_arg('step', 3)); ?>"> <p class="hide-if-no-js"><?php _e('Choose the part of the image you want to use as your header.'); ?></p> <p class="hide-if-js"><strong><?php _e( 'You need Javascript to choose a part of the image.'); ?></strong></p> <div id="crop_image" style="position: relative"> <img src="<?php echo esc_url( $url ); ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" /> </div> <input type="hidden" name="x1" id="x1" value="0"/> <input type="hidden" name="y1" id="y1" value="0"/> <input type="hidden" name="width" id="width" value="<?php echo esc_attr( $width ); ?>"/> <input type="hidden" name="height" id="height" value="<?php echo esc_attr( $height ); ?>"/> <input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo esc_attr( $attachment_id ); ?>" /> <input type="hidden" name="oitar" id="oitar" value="<?php echo esc_attr( $oitar ); ?>" /> <?php if ( empty( $_POST ) && isset( $_GET['file'] ) ) { ?> <input type="hidden" name="create-new-attachment" value="true" /> <?php } ?> <?php wp_nonce_field( 'custom-header-crop-image' ) ?> <p class="submit"> <?php submit_button( __( 'Crop and Publish' ), 'primary', 'submit', false ); ?> <?php if ( isset( $oitar ) && 1 == $oitar && ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) ) submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false ); ?> </p> </form> </div> <?php } /** * Upload the file to be cropped in the second step. * * @since 3.4.0 */ function step_2_manage_upload() { $overrides = array('test_form' => false); $uploaded_file = $_FILES['import']; $wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'], false ); if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) ); $file = wp_handle_upload($uploaded_file, $overrides); if ( isset($file['error']) ) wp_die( $file['error'], __( 'Image Upload Error' ) ); $url = $file['url']; $type = $file['type']; $file = $file['file']; $filename = basename($file); // Construct the object array $object = array( 'post_title' => $filename, 'post_content' => $url, 'post_mime_type' => $type, 'guid' => $url, 'context' => 'custom-header' ); // Save the data $attachment_id = wp_insert_attachment( $object, $file ); return compact( 'attachment_id', 'file', 'filename', 'url', 'type' ); } /** * Display third step of custom header image page. * * @since 2.1.0 */ function step_3() { check_admin_referer( 'custom-header-crop-image' ); if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) wp_die( __( 'Cheatin&#8217; uh?' ) ); if ( ! empty( $_POST['skip-cropping'] ) && ! ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) ) wp_die( __( 'Cheatin&#8217; uh?' ) ); if ( $_POST['oitar'] > 1 ) { $_POST['x1'] = $_POST['x1'] * $_POST['oitar']; $_POST['y1'] = $_POST['y1'] * $_POST['oitar']; $_POST['width'] = $_POST['width'] * $_POST['oitar']; $_POST['height'] = $_POST['height'] * $_POST['oitar']; } $attachment_id = absint( $_POST['attachment_id'] ); $original = get_attached_file($attachment_id); $dimensions = $this->get_header_dimensions( array( 'height' => $_POST['height'], 'width' => $_POST['width'], ) ); $height = $dimensions['dst_height']; $width = $dimensions['dst_width']; if ( empty( $_POST['skip-cropping'] ) ) $cropped = wp_crop_image( $attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], $width, $height ); elseif ( ! empty( $_POST['create-new-attachment'] ) ) $cropped = _copy_image_file( $attachment_id ); else $cropped = get_attached_file( $attachment_id ); if ( ! $cropped || is_wp_error( $cropped ) ) wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); /** This filter is documented in wp-admin/custom-header.php */ $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication $object = $this->create_attachment_object( $cropped, $attachment_id ); if ( ! empty( $_POST['create-new-attachment'] ) ) unset( $object['ID'] ); // Update the attachment $attachment_id = $this->insert_attachment( $object, $cropped ); $url = $object['guid']; $this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) ); // cleanup $medium = str_replace( basename( $original ), 'midsize-' . basename( $original ), $original ); if ( file_exists( $medium ) ) { /** * Filter the path of the file to delete. * * @since 2.1.0 * * @param string $medium Path to the file to delete. */ @unlink( apply_filters( 'wp_delete_file', $medium ) ); } if ( empty( $_POST['create-new-attachment'] ) && empty( $_POST['skip-cropping'] ) ) { /** This filter is documented in wp-admin/custom-header.php */ @unlink( apply_filters( 'wp_delete_file', $original ) ); } return $this->finished(); } /** * Display last step of custom header image page. * * @since 2.1.0 */ function finished() { $this->updated = true; $this->step_1(); } /** * Display the page based on the current step. * * @since 2.1.0 */ function admin_page() { if ( ! current_user_can('edit_theme_options') ) wp_die(__('You do not have permission to customize headers.')); $step = $this->step(); if ( 2 == $step ) $this->step_2(); elseif ( 3 == $step ) $this->step_3(); else $this->step_1(); } /** * Unused since 3.5.0. * * @since 3.4.0 */ function attachment_fields_to_edit( $form_fields ) { return $form_fields; } /** * Unused since 3.5.0. * * @since 3.4.0 */ function filter_upload_tabs( $tabs ) { return $tabs; } /** * Choose a header image, selected from existing uploaded and default headers, * or provide an array of uploaded header data (either new, or from media library). * * @param mixed $choice Which header image to select. Allows for values of 'random-default-image', * for randomly cycling among the default images; 'random-uploaded-image', for randomly cycling * among the uploaded images; the key of a default image registered for that theme; and * the key of an image uploaded for that theme (the basename of the URL). * Or an array of arguments: attachment_id, url, width, height. All are required. * * @since 3.4.0 */ final public function set_header_image( $choice ) { if ( is_array( $choice ) || is_object( $choice ) ) { $choice = (array) $choice; if ( ! isset( $choice['attachment_id'] ) || ! isset( $choice['url'] ) ) return; $choice['url'] = esc_url_raw( $choice['url'] ); $header_image_data = (object) array( 'attachment_id' => $choice['attachment_id'], 'url' => $choice['url'], 'thumbnail_url' => $choice['url'], 'height' => $choice['height'], 'width' => $choice['width'], ); update_post_meta( $choice['attachment_id'], '_wp_attachment_is_custom_header', get_stylesheet() ); set_theme_mod( 'header_image', $choice['url'] ); set_theme_mod( 'header_image_data', $header_image_data ); return; } if ( in_array( $choice, array( 'remove-header', 'random-default-image', 'random-uploaded-image' ) ) ) { set_theme_mod( 'header_image', $choice ); remove_theme_mod( 'header_image_data' ); return; } $uploaded = get_uploaded_header_images(); if ( $uploaded && isset( $uploaded[ $choice ] ) ) { $header_image_data = $uploaded[ $choice ]; } else { $this->process_default_headers(); if ( isset( $this->default_headers[ $choice ] ) ) $header_image_data = $this->default_headers[ $choice ]; else return; } set_theme_mod( 'header_image', esc_url_raw( $header_image_data['url'] ) ); set_theme_mod( 'header_image_data', $header_image_data ); } /** * Remove a header image. * * @since 3.4.0 */ final public function remove_header_image() { return $this->set_header_image( 'remove-header' ); } /** * Reset a header image to the default image for the theme. * * This method does not do anything if the theme does not have a default header image. * * @since 3.4.0 */ final public function reset_header_image() { $this->process_default_headers(); $default = get_theme_support( 'custom-header', 'default-image' ); if ( ! $default ) return $this->remove_header_image(); $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() ); $default_data = array(); foreach ( $this->default_headers as $header => $details ) { if ( $details['url'] == $default ) { $default_data = $details; break; } } set_theme_mod( 'header_image', $default ); set_theme_mod( 'header_image_data', (object) $default_data ); } /** * Calculate width and height based on what the currently selected theme supports. * * @return array dst_height and dst_width of header image. */ final public function get_header_dimensions( $dimensions ) { $max_width = 0; $width = absint( $dimensions['width'] ); $height = absint( $dimensions['height'] ); $theme_height = get_theme_support( 'custom-header', 'height' ); $theme_width = get_theme_support( 'custom-header', 'width' ); $has_flex_width = current_theme_supports( 'custom-header', 'flex-width' ); $has_flex_height = current_theme_supports( 'custom-header', 'flex-height' ); $has_max_width = current_theme_supports( 'custom-header', 'max-width' ) ; $dst = array( 'dst_height' => null, 'dst_height' => null ); // For flex, limit size of image displayed to 1500px unless theme says otherwise if ( $has_flex_width ) { $max_width = 1500; } if ( $has_max_width ) { $max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) ); } $max_width = max( $max_width, $theme_width ); if ( $has_flex_height && ( ! $has_flex_width || $width > $max_width ) ) { $dst['dst_height'] = absint( $height * ( $max_width / $width ) ); } elseif ( $has_flex_height && $has_flex_width ) { $dst['dst_height'] = $height; } else { $dst['dst_height'] = $theme_height; } if ( $has_flex_width && ( ! $has_flex_height || $width > $max_width ) ) { $dst['dst_width'] = absint( $width * ( $max_width / $width ) ); } elseif ( $has_flex_width && $has_flex_height ) { $dst['dst_width'] = $width; } else { $dst['dst_width'] = $theme_width; } return $dst; } /** * Create an attachment 'object'. * * @param string $cropped Cropped image URL. * @param int $parent_attachment_id Attachment ID of parent image. * * @return array Attachment object. */ final public function create_attachment_object( $cropped, $parent_attachment_id ) { $parent = get_post( $parent_attachment_id ); $parent_url = $parent->guid; $url = str_replace( basename( $parent_url ), basename( $cropped ), $parent_url ); $size = @getimagesize( $cropped ); $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; $object = array( 'ID' => $parent_attachment_id, 'post_title' => basename($cropped), 'post_content' => $url, 'post_mime_type' => $image_type, 'guid' => $url, 'context' => 'custom-header' ); return $object; } /** * Insert an attachment & its metadata. * * @param array $object Attachment object. * @param string $cropped Cropped image URL. * * @return int Attachment ID. */ final public function insert_attachment( $object, $cropped ) { $attachment_id = wp_insert_attachment( $object, $cropped ); $metadata = wp_generate_attachment_metadata( $attachment_id, $cropped ); /** * Allows us to insert custom meta data for an attachment. * */ $metadata = apply_filters( 'wp_header_image_attachment_metadata', $metadata ); wp_update_attachment_metadata( $attachment_id, $metadata ); return $attachment_id; } /** * Gets attachment uploaded by Media Manager, crops it, then saves it as a * new object. Returns JSON-encoded object details. */ function ajax_header_crop() { check_ajax_referer( 'image_editor-' . $_POST['id'], 'nonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_send_json_error(); } if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) { wp_send_json_error(); } $crop_details = $_POST['cropDetails']; $dimensions = $this->get_header_dimensions( array( 'height' => $crop_details['height'], 'width' => $crop_details['width'], ) ); $attachment_id = absint( $_POST['id'] ); $cropped = wp_crop_image( $attachment_id, (int) $crop_details['x1'], (int) $crop_details['y1'], (int) $crop_details['width'], (int) $crop_details['height'], (int) $dimensions['dst_width'], (int) $dimensions['dst_height'] ); if ( ! $cropped || is_wp_error( $cropped ) ) { wp_send_json_error( array( 'message' => __( 'Image could not be processed. Please go back and try again.' ) ) ); } $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication $object = $this->create_attachment_object( $cropped, $attachment_id ); unset( $object['ID'] ); $new_attachment_id = $this->insert_attachment( $object, $cropped ); $object['attachment_id'] = $new_attachment_id; $object['width'] = $dimensions['dst_width']; $object['height'] = $dimensions['dst_height']; wp_send_json_success( $object ); } /** * Given an attachment ID for a header image, updates its "last used" * timestamp to now. * * Triggered when the user tries adds a new header image from the * Media Manager, even if s/he doesn't save that change. */ function ajax_header_add() { check_ajax_referer( 'header-add', 'nonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_send_json_error(); } $attachment_id = absint( $_POST['attachment_id'] ); if ( $attachment_id < 1 ) { wp_send_json_error(); } $key = '_wp_attachment_custom_header_last_used_' . get_stylesheet(); update_post_meta( $attachment_id, $key, time() ); update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', get_stylesheet() ); wp_send_json_success(); } /** * Given an attachment ID for a header image, unsets it as a user-uploaded * header image for the current theme. * * Triggered when the user clicks the overlay "X" button next to each image * choice in the Customizer's Header tool. */ function ajax_header_remove() { check_ajax_referer( 'header-remove', 'nonce' ); if ( ! current_user_can( 'edit_theme_options' ) ) { wp_send_json_error(); } $attachment_id = absint( $_POST['attachment_id'] ); if ( $attachment_id < 1 ) { wp_send_json_error(); } $key = '_wp_attachment_custom_header_last_used_' . get_stylesheet(); delete_post_meta( $attachment_id, $key ); delete_post_meta( $attachment_id, '_wp_attachment_is_custom_header', get_stylesheet() ); wp_send_json_success(); } function customize_set_last_used( $wp_customize ) { $data = $wp_customize->get_setting( 'header_image_data' )->post_value(); if ( ! isset( $data['attachment_id'] ) ) { return; } $attachment_id = $data['attachment_id']; $key = '_wp_attachment_custom_header_last_used_' . get_stylesheet(); update_post_meta( $attachment_id, $key, time() ); } public function get_default_header_images() { $this->process_default_headers(); // Get the default image if there is one. $default = get_theme_support( 'custom-header', 'default-image' ); if ( ! $default ) { // If not, return $this->default_headers; // easy peasy. } $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() ); $already_has_default = false; foreach ( $this->default_headers as $k => $h ) { if ( $h['url'] === $default ) { $already_has_default = true; break; } } if ( $already_has_default ) { return $this->default_headers; } // If the one true image isn't included in the default set, prepend it. $header_images = array(); $header_images['default'] = array( 'url' => $default, 'thumbnail_url' => $default, 'description' => 'Default' ); // The rest of the set comes after. $header_images = array_merge( $header_images, $this->default_headers ); return $header_images; } public function get_uploaded_header_images() { $header_images = get_uploaded_header_images(); $timestamp_key = '_wp_attachment_custom_header_last_used_' . get_stylesheet(); $alt_text_key = '_wp_attachment_image_alt'; foreach ( $header_images as &$header_image ) { $header_meta = get_post_meta( $header_image['attachment_id'] ); $header_image['timestamp'] = isset( $header_meta[ $timestamp_key ] ) ? $header_meta[ $timestamp_key ] : ''; $header_image['alt_text'] = isset( $header_meta[ $alt_text_key ] ) ? $header_meta[ $alt_text_key ] : ''; } return $header_images; } }
01-wordpress-paypal
trunk/wp-admin/custom-header.php
PHP
gpl3
42,124
<?php /** * Manage link administration actions. * * This page is accessed by the link management pages and handles the forms and * AJAX processes for link actions. * * @package WordPress * @subpackage Administration */ /** Load WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); wp_reset_vars( array( 'action', 'cat_id', 'link_id' ) ); if ( ! current_user_can('manage_links') ) wp_link_manager_disabled_message(); if ( !empty($_POST['deletebookmarks']) ) $action = 'deletebookmarks'; if ( !empty($_POST['move']) ) $action = 'move'; if ( !empty($_POST['linkcheck']) ) $linkcheck = $_POST['linkcheck']; $this_file = admin_url('link-manager.php'); switch ($action) { case 'deletebookmarks' : check_admin_referer('bulk-bookmarks'); //for each link id (in $linkcheck[]) change category to selected value if (count($linkcheck) == 0) { wp_redirect($this_file); exit; } $deleted = 0; foreach ($linkcheck as $link_id) { $link_id = (int) $link_id; if ( wp_delete_link($link_id) ) $deleted++; } wp_redirect("$this_file?deleted=$deleted"); exit; break; case 'move' : check_admin_referer('bulk-bookmarks'); //for each link id (in $linkcheck[]) change category to selected value if (count($linkcheck) == 0) { wp_redirect($this_file); exit; } $all_links = join(',', $linkcheck); // should now have an array of links we can change //$q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)"); wp_redirect($this_file); exit; break; case 'add' : check_admin_referer('add-bookmark'); $redir = wp_get_referer(); if ( add_link() ) $redir = add_query_arg( 'added', 'true', $redir ); wp_redirect( $redir ); exit; break; case 'save' : $link_id = (int) $_POST['link_id']; check_admin_referer('update-bookmark_' . $link_id); edit_link($link_id); wp_redirect($this_file); exit; break; case 'delete' : $link_id = (int) $_GET['link_id']; check_admin_referer('delete-bookmark_' . $link_id); wp_delete_link($link_id); wp_redirect($this_file); exit; break; case 'edit' : wp_enqueue_script('link'); wp_enqueue_script('xfn'); if ( wp_is_mobile() ) wp_enqueue_script( 'jquery-touch-punch' ); $parent_file = 'link-manager.php'; $submenu_file = 'link-manager.php'; $title = __('Edit Link'); $link_id = (int) $_GET['link_id']; if (!$link = get_link_to_edit($link_id)) wp_die(__('Link not found.')); include( ABSPATH . 'wp-admin/edit-link-form.php' ); include( ABSPATH . 'wp-admin/admin-footer.php' ); break; default : break; }
01-wordpress-paypal
trunk/wp-admin/link.php
PHP
gpl3
2,649
<?php /** * Manage media uploaded file. * * There are many filters in here for media. Plugins can extend functionality * by hooking into the filters. * * @package WordPress * @subpackage Administration */ if ( ! isset( $_GET['inline'] ) ) define( 'IFRAME_REQUEST' , true ); /** Load WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); if (!current_user_can('upload_files')) wp_die(__('You do not have permission to upload files.')); wp_enqueue_script('plupload-handlers'); wp_enqueue_script('image-edit'); wp_enqueue_script('set-post-thumbnail' ); wp_enqueue_style('imgareaselect'); wp_enqueue_script( 'media-gallery' ); @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); // IDs should be integers $ID = isset($ID) ? (int) $ID : 0; $post_id = isset($post_id)? (int) $post_id : 0; // Require an ID for the edit screen if ( isset($action) && $action == 'edit' && !$ID ) wp_die( __( 'Cheatin&#8217; uh?' ) ); if ( ! empty( $_REQUEST['post_id'] ) && ! current_user_can( 'edit_post' , $_REQUEST['post_id'] ) ) wp_die( __( 'Cheatin&#8217; uh?' ) ); // upload type: image, video, file, ..? if ( isset($_GET['type']) ) { $type = strval($_GET['type']); } else { /** * Filter the default media upload type in the legacy (pre-3.5.0) media popup. * * @since 2.5.0 * * @param string $type The default media upload type. Possible values include * 'image', 'audio', 'video', 'file', etc. Default 'file'. */ $type = apply_filters( 'media_upload_default_type', 'file' ); } // tab: gallery, library, or type-specific if ( isset($_GET['tab']) ) { $tab = strval($_GET['tab']); } else { /** * Filter the default tab in the legacy (pre-3.5.0) media popup. * * @since 2.5.0 * * @param string $type The default media popup tab. Default 'type' (From Computer). */ $tab = apply_filters( 'media_upload_default_tab', 'type' ); } $body_id = 'media-upload'; // let the action code decide how to handle the request if ( $tab == 'type' || $tab == 'type_url' || ! array_key_exists( $tab , media_upload_tabs() ) ) { /** * Fires inside specific upload-type views in the legacy (pre-3.5.0) * media popup based on the current tab. * * The dynamic portion of the hook name, $type, refers to the specific * media upload type. Possible values include 'image', 'audio', 'video', * 'file', etc. * * The hook only fires if the current $tab is 'type' (From Computer), * 'type_url' (From URL), or, if the tab does not exist (i.e., has not * been registered via the 'media_upload_tabs' filter. * * @since 2.5.0 */ do_action( "media_upload_$type" ); } else { /** * Fires inside limited and specific upload-tab views in the legacy * (pre-3.5.0) media popup. * * The dynamic portion of the hook name, $tab, refers to the specific * media upload tab. Possible values include 'library' (Media Library), * or any custom tab registered via the 'media_upload_tabs' filter. * * @since 2.5.0 */ do_action( "media_upload_$tab" ); }
01-wordpress-paypal
trunk/wp-admin/media-upload.php
PHP
gpl3
3,143
<?php /** * Discussion settings administration panel. * * @package WordPress * @subpackage Administration */ /** WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); if ( ! current_user_can( 'manage_options' ) ) wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) ); $title = __('Discussion Settings'); $parent_file = 'options-general.php'; get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('This screen provides many options for controlling the management and display of comments and links to your posts/pages. So many, in fact, they won&#8217;t all fit here! :) Use the documentation links to get information on what each discussion setting does.') . '</p>' . '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>', ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Settings_Discussion_Screen" target="_blank">Documentation on Discussion Settings</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); include( ABSPATH . 'wp-admin/admin-header.php' ); ?> <div class="wrap"> <h2><?php echo esc_html( $title ); ?></h2> <form method="post" action="options.php"> <?php settings_fields('discussion'); ?> <table class="form-table"> <tr> <th scope="row"><?php _e('Default article settings'); ?></th> <td><fieldset><legend class="screen-reader-text"><span><?php _e('Default article settings'); ?></span></legend> <label for="default_pingback_flag"> <input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_option('default_pingback_flag')); ?> /> <?php _e('Attempt to notify any blogs linked to from the article'); ?></label> <br /> <label for="default_ping_status"> <input name="default_ping_status" type="checkbox" id="default_ping_status" value="open" <?php checked('open', get_option('default_ping_status')); ?> /> <?php _e('Allow link notifications from other blogs (pingbacks and trackbacks)'); ?></label> <br /> <label for="default_comment_status"> <input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_option('default_comment_status')); ?> /> <?php _e('Allow people to post comments on new articles'); ?></label> <br /> <p class="description"><?php echo '(' . __( 'These settings may be overridden for individual articles.' ) . ')'; ?></p> </fieldset></td> </tr> <tr> <th scope="row"><?php _e('Other comment settings'); ?></th> <td><fieldset><legend class="screen-reader-text"><span><?php _e('Other comment settings'); ?></span></legend> <label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_option('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail'); ?></label> <br /> <label for="comment_registration"> <input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> /> <?php _e('Users must be registered and logged in to comment'); ?> <?php if ( !get_option( 'users_can_register' ) && is_multisite() ) echo ' ' . __( '(Signup has been disabled. Only members of this site can comment.)' ); ?> </label> <br /> <label for="close_comments_for_old_posts"> <input name="close_comments_for_old_posts" type="checkbox" id="close_comments_for_old_posts" value="1" <?php checked('1', get_option('close_comments_for_old_posts')); ?> /> <?php printf( __('Automatically close comments on articles older than %s days'), '</label><label for="close_comments_days_old"><input name="close_comments_days_old" type="number" min="0" step="1" id="close_comments_days_old" value="' . esc_attr(get_option('close_comments_days_old')) . '" class="small-text" />'); ?> </label> <br /> <label for="thread_comments"> <input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked('1', get_option('thread_comments')); ?> /> <?php /** * Filter the maximum depth of threaded/nested comments. * * @since 2.7.0. * * @param int $max_depth The maximum depth of threaded comments. Default 10. */ $maxdeep = (int) apply_filters( 'thread_comments_depth_max', 10 ); $thread_comments_depth = '</label><label for="thread_comments_depth"><select name="thread_comments_depth" id="thread_comments_depth">'; for ( $i = 2; $i <= $maxdeep; $i++ ) { $thread_comments_depth .= "<option value='" . esc_attr($i) . "'"; if ( get_option('thread_comments_depth') == $i ) $thread_comments_depth .= " selected='selected'"; $thread_comments_depth .= ">$i</option>"; } $thread_comments_depth .= '</select>'; printf( __('Enable threaded (nested) comments %s levels deep'), $thread_comments_depth ); ?></label> <br /> <label for="page_comments"> <input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked('1', get_option('page_comments')); ?> /> <?php $default_comments_page = '</label><label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"'; if ( 'newest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"'; $default_comments_page .= '>' . __('last') . '</option><option value="oldest"'; if ( 'oldest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"'; $default_comments_page .= '>' . __('first') . '</option></select>'; printf( __('Break comments into pages with %1$s top level comments per page and the %2$s page displayed by default'), '</label><label for="comments_per_page"><input name="comments_per_page" type="number" step="1" min="0" id="comments_per_page" value="' . esc_attr(get_option('comments_per_page')) . '" class="small-text" />', $default_comments_page ); ?></label> <br /> <label for="comment_order"><?php $comment_order = '<select name="comment_order" id="comment_order"><option value="asc"'; if ( 'asc' == get_option('comment_order') ) $comment_order .= ' selected="selected"'; $comment_order .= '>' . __('older') . '</option><option value="desc"'; if ( 'desc' == get_option('comment_order') ) $comment_order .= ' selected="selected"'; $comment_order .= '>' . __('newer') . '</option></select>'; printf( __('Comments should be displayed with the %s comments at the top of each page'), $comment_order ); ?></label> </fieldset></td> </tr> <tr> <th scope="row"><?php _e('E-mail me whenever'); ?></th> <td><fieldset><legend class="screen-reader-text"><span><?php _e('E-mail me whenever'); ?></span></legend> <label for="comments_notify"> <input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> /> <?php _e('Anyone posts a comment'); ?> </label> <br /> <label for="moderation_notify"> <input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_option('moderation_notify')); ?> /> <?php _e('A comment is held for moderation'); ?> </label> </fieldset></td> </tr> <tr> <th scope="row"><?php _e('Before a comment appears'); ?></th> <td><fieldset><legend class="screen-reader-text"><span><?php _e('Before a comment appears'); ?></span></legend> <label for="comment_moderation"> <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_option('comment_moderation')); ?> /> <?php _e('Comment must be manually approved'); ?> </label> <br /> <label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_option('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment'); ?></label> </fieldset></td> </tr> <tr> <th scope="row"><?php _e('Comment Moderation'); ?></th> <td><fieldset><legend class="screen-reader-text"><span><?php _e('Comment Moderation'); ?></span></legend> <p><label for="comment_max_links"><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="number" step="1" min="0" id="comment_max_links" value="' . esc_attr(get_option('comment_max_links')) . '" class="small-text" />' ); ?></label></p> <p><label for="moderation_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP per line. It will match inside words, so &#8220;press&#8221; will match &#8220;WordPress&#8221;.'); ?></label></p> <p> <textarea name="moderation_keys" rows="10" cols="50" id="moderation_keys" class="large-text code"><?php echo esc_textarea( get_option( 'moderation_keys' ) ); ?></textarea> </p> </fieldset></td> </tr> <tr> <th scope="row"><?php _e('Comment Blacklist'); ?></th> <td><fieldset><legend class="screen-reader-text"><span><?php _e('Comment Blacklist'); ?></span></legend> <p><label for="blacklist_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so &#8220;press&#8221; will match &#8220;WordPress&#8221;.'); ?></label></p> <p> <textarea name="blacklist_keys" rows="10" cols="50" id="blacklist_keys" class="large-text code"><?php echo esc_textarea( get_option( 'blacklist_keys' ) ); ?></textarea> </p> </fieldset></td> </tr> <?php do_settings_fields('discussion', 'default'); ?> </table> <h3 class="title"><?php _e('Avatars'); ?></h3> <p><?php _e('An avatar is an image that follows you from weblog to weblog appearing beside your name when you comment on avatar enabled sites. Here you can enable the display of avatars for people who comment on your site.'); ?></p> <?php // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that? ?> <table class="form-table"> <tr> <th scope="row"><?php _e('Avatar Display'); ?></th> <td><fieldset><legend class="screen-reader-text"><span><?php _e('Avatar Display'); ?></span></legend> <label for="show_avatars"> <input type="checkbox" id="show_avatars" name="show_avatars" value="1" <?php checked( get_option('show_avatars'), 1 ); ?> /> <?php _e( 'Show Avatars' ); ?> </label> </fieldset></td> </tr> <tr> <th scope="row"><?php _e('Maximum Rating'); ?></th> <td><fieldset><legend class="screen-reader-text"><span><?php _e('Maximum Rating'); ?></span></legend> <?php $ratings = array( /* translators: Content suitability rating: http://bit.ly/89QxZA */ 'G' => __('G &#8212; Suitable for all audiences'), /* translators: Content suitability rating: http://bit.ly/89QxZA */ 'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'), /* translators: Content suitability rating: http://bit.ly/89QxZA */ 'R' => __('R &#8212; Intended for adult audiences above 17'), /* translators: Content suitability rating: http://bit.ly/89QxZA */ 'X' => __('X &#8212; Even more mature than above') ); foreach ($ratings as $key => $rating) : $selected = (get_option('avatar_rating') == $key) ? 'checked="checked"' : ''; echo "\n\t<label><input type='radio' name='avatar_rating' value='" . esc_attr($key) . "' $selected/> $rating</label><br />"; endforeach; ?> </fieldset></td> </tr> <tr> <th scope="row"><?php _e('Default Avatar'); ?></th> <td class="defaultavatarpicker"><fieldset><legend class="screen-reader-text"><span><?php _e('Default Avatar'); ?></span></legend> <?php _e('For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their e-mail address.'); ?><br /> <?php $avatar_defaults = array( 'mystery' => __('Mystery Man'), 'blank' => __('Blank'), 'gravatar_default' => __('Gravatar Logo'), 'identicon' => __('Identicon (Generated)'), 'wavatar' => __('Wavatar (Generated)'), 'monsterid' => __('MonsterID (Generated)'), 'retro' => __('Retro (Generated)') ); /** * Filter the default avatars. * * Avatars are stored in key/value pairs, where the key is option value, * and the name is the displayed avatar name. * * @since 2.6.0 * * @param array $avatar_defaults Array of default avatars. */ $avatar_defaults = apply_filters( 'avatar_defaults', $avatar_defaults ); $default = get_option('avatar_default'); if ( empty($default) ) $default = 'mystery'; $size = 32; $avatar_list = ''; foreach ( $avatar_defaults as $default_key => $default_name ) { $selected = ($default == $default_key) ? 'checked="checked" ' : ''; $avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr($default_key) . "' {$selected}/> "; $avatar = get_avatar( $user_email, $size, $default_key ); $avatar_list .= preg_replace("/src='(.+?)'/", "src='\$1&amp;forcedefault=1'", $avatar); $avatar_list .= ' ' . $default_name . '</label>'; $avatar_list .= '<br />'; } /** * Filter the HTML output of the default avatar list. * * @since 2.6.0 * * @param string $avatar_list HTML markup of the avatar list. */ echo apply_filters( 'default_avatar_select', $avatar_list ); ?> </fieldset></td> </tr> <?php do_settings_fields('discussion', 'avatars'); ?> </table> <?php do_settings_sections('discussion'); ?> <?php submit_button(); ?> </form> </div> <?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
01-wordpress-paypal
trunk/wp-admin/options-discussion.php
PHP
gpl3
13,677
<?php /** * Multisite upgrade administration panel. * * @package WordPress * @subpackage Multisite * @since 3.0.0 */ require_once( dirname( __FILE__ ) . '/admin.php' ); wp_redirect( network_admin_url('upgrade.php') ); exit;
01-wordpress-paypal
trunk/wp-admin/ms-upgrade-network.php
PHP
gpl3
232
<?php /** * Dashboard Administration Screen * * @package WordPress * @subpackage Administration */ /** Load WordPress Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); /** Load WordPress dashboard API */ require_once(ABSPATH . 'wp-admin/includes/dashboard.php'); wp_dashboard_setup(); wp_enqueue_script( 'dashboard' ); if ( current_user_can( 'edit_theme_options' ) ) wp_enqueue_script( 'customize-loader' ); if ( current_user_can( 'install_plugins' ) ) wp_enqueue_script( 'plugin-install' ); if ( current_user_can( 'upload_files' ) ) wp_enqueue_script( 'media-upload' ); add_thickbox(); if ( wp_is_mobile() ) wp_enqueue_script( 'jquery-touch-punch' ); $title = __('Dashboard'); $parent_file = 'index.php'; $help = '<p>' . __( 'Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab in the upper corner.' ) . '</p>'; // Not using chaining here, so as to be parseable by PHP4. $screen = get_current_screen(); $screen->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => $help, ) ); // Help tabs $help = '<p>' . __( 'The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.' ) . '</p>'; $help .= '<p>' . __( 'Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.' ) . '</p>'; $screen->add_help_tab( array( 'id' => 'help-navigation', 'title' => __( 'Navigation' ), 'content' => $help, ) ); $help = '<p>' . __( 'You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.' ) . '</p>'; $help .= '<p>' . __( '<strong>Screen Options</strong> - Use the Screen Options tab to choose which Dashboard boxes to show.' ) . '</p>'; $help .= '<p>' . __( '<strong>Drag and Drop</strong> - To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.' ) . '</p>'; $help .= '<p>' . __( '<strong>Box Controls</strong> - Click the title bar of the box to expand or collapse it. Some boxes added by plugins may have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.' ) . '</p>'; $screen->add_help_tab( array( 'id' => 'help-layout', 'title' => __( 'Layout' ), 'content' => $help, ) ); $help = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>'; if ( current_user_can( 'edit_posts' ) ) $help .= '<p>' . __( '<strong>At A Glance</strong> - Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '</p>'; $help .= '<p>' . __( '<strong>Activity</strong> - Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.' ) . '</p>'; if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) $help .= '<p>' . __( "<strong>Quick Draft</strong> - Allows you to create a new post and save it as a draft. Also displays links to the 5 most recent draft posts you've started." ) . '</p>'; if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) $help .= '<p>' . __( '<strong>WordPress News</strong> - Latest news from the official WordPress project, the <a href="http://planet.wordpress.org/">WordPress Planet</a>, and popular and recent plugins.' ) . '</p>'; else $help .= '<p>' . __( '<strong>WordPress News</strong> - Latest news from the official WordPress project, the <a href="http://planet.wordpress.org/">WordPress Planet</a>.' ) . '</p>'; if ( current_user_can( 'edit_theme_options' ) ) $help .= '<p>' . __( '<strong>Welcome</strong> - Shows links for some of the most common tasks when setting up a new site.' ) . '</p>'; $screen->add_help_tab( array( 'id' => 'help-content', 'title' => __( 'Content' ), 'content' => $help, ) ); unset( $help ); $screen->set_help_sidebar( '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . '<p>' . __( '<a href="http://codex.wordpress.org/Dashboard_Screen" target="_blank">Documentation on Dashboard</a>' ) . '</p>' . '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' ); include( ABSPATH . 'wp-admin/admin-header.php' ); ?> <div class="wrap"> <h2><?php echo esc_html( $title ); ?></h2> <?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) : $classes = 'welcome-panel'; $option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner $hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) ); if ( $hide ) $classes .= ' hidden'; ?> <div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>"> <?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?> <a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>"><?php _e( 'Dismiss' ); ?></a> <?php /** * Add content to the welcome panel on the admin dashboard. * * To remove the default welcome panel, use remove_action(): * <code>remove_action( 'welcome_panel', 'wp_welcome_panel' );</code> * * @since 3.5.0 */ do_action( 'welcome_panel' ); ?> </div> <?php endif; ?> <div id="dashboard-widgets-wrap"> <?php wp_dashboard(); ?> </div><!-- dashboard-widgets-wrap --> </div><!-- wrap --> <?php require( ABSPATH . 'wp-admin/admin-footer.php' );
01-wordpress-paypal
trunk/wp-admin/index.php
PHP
gpl3
5,989
<?php /** * My Sites dashboard. * * @package WordPress * @subpackage Multisite * @since 3.0.0 */ require_once( dirname( __FILE__ ) . '/admin.php' ); if ( !is_multisite() ) wp_die( __( 'Multisite support is not enabled.' ) ); if ( ! current_user_can('read') ) wp_die( __( 'You do not have sufficient permissions to view this page.' ) ); $action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash'; $blogs = get_blogs_of_user( $current_user->ID ); $updated = false; if ( 'updateblogsettings' == $action && isset( $_POST['primary_blog'] ) ) { check_admin_referer( 'update-my-sites' ); $blog = get_blog_details( (int) $_POST['primary_blog'] ); if ( $blog && isset( $blog->domain ) ) { update_user_option( $current_user->ID, 'primary_blog', (int) $_POST['primary_blog'], true ); $updated = true; } else { wp_die( __( 'The primary site you chose does not exist.' ) ); } } $title = __( 'My Sites' ); $parent_file = 'index.php'; get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('This screen shows an individual user all of their sites in this network, and also allows that user to set a primary site. They can use the links under each site to visit either the frontend or the dashboard for that site.') . '</p>' . '<p>' . __('Up until WordPress version 3.0, what is now called a Multisite Network had to be installed separately as WordPress MU (multi-user).') . '</p>' ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Dashboard_My_Sites_Screen" target="_blank">Documentation on My Sites</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); require_once( ABSPATH . 'wp-admin/admin-header.php' ); if ( $updated ) { ?> <div id="message" class="updated"><p><strong><?php _e( 'Settings saved.' ); ?></strong></p></div> <?php } ?> <div class="wrap"> <h2><?php echo esc_html( $title ); ?></h2> <?php if ( empty( $blogs ) ) : echo '<p>'; _e( 'You must be a member of at least one site to use this page.' ); echo '</p>'; else : ?> <form id="myblogs" action="" method="post"> <?php choose_primary_blog(); /** * Fires before the sites table on the My Sites screen. * * @since 3.0.0 */ do_action( 'myblogs_allblogs_options' ); ?> <br clear="all" /> <table class="widefat fixed"> <?php /** * Enable the Global Settings section on the My Sites screen. * * By default, the Global Settings section is hidden. Passing a non-empty * string to this filter will enable the section, and allow new settings * to be added, either globally or for specific sites. * * @since MU * * @param string $settings_html The settings HTML markup. Default empty. * @param object $context Context of the setting (global or site-specific). Default 'global'. */ $settings_html = apply_filters( 'myblogs_options', '', 'global' ); if ( $settings_html != '' ) { echo '<tr><td><h3>' . __( 'Global Settings' ) . '</h3></td><td>'; echo $settings_html; echo '</td></tr>'; } reset( $blogs ); $num = count( $blogs ); $cols = 1; if ( $num >= 20 ) $cols = 4; elseif ( $num >= 10 ) $cols = 2; $num_rows = ceil( $num / $cols ); $split = 0; for ( $i = 1; $i <= $num_rows; $i++ ) { $rows[] = array_slice( $blogs, $split, $cols ); $split = $split + $cols; } $c = ''; foreach ( $rows as $row ) { $c = $c == 'alternate' ? '' : 'alternate'; echo "<tr class='$c'>"; $i = 0; foreach ( $row as $user_blog ) { $s = $i == 3 ? '' : 'border-right: 1px solid #ccc;'; echo "<td style='$s'>"; echo "<h3>{$user_blog->blogname}</h3>"; /** * Filter the row links displayed for each site on the My Sites screen. * * @since MU * * @param string $string The HTML site link markup. * @param object $user_blog An object containing the site data. */ echo "<p>" . apply_filters( 'myblogs_blog_actions', "<a href='" . esc_url( get_home_url( $user_blog->userblog_id ) ). "'>" . __( 'Visit' ) . "</a> | <a href='" . esc_url( get_admin_url( $user_blog->userblog_id ) ) . "'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>"; /** This filter is documented in wp-admin/my-sites.php */ echo apply_filters( 'myblogs_options', '', $user_blog ); echo "</td>"; $i++; } echo "</tr>"; }?> </table> <input type="hidden" name="action" value="updateblogsettings" /> <?php wp_nonce_field( 'update-my-sites' ); ?> <?php submit_button(); ?> </form> <?php endif; ?> </div> <?php include( ABSPATH . 'wp-admin/admin-footer.php' );
01-wordpress-paypal
trunk/wp-admin/my-sites.php
PHP
gpl3
4,676
<?php /** * Edit user administration panel. * * @package WordPress * @subpackage Administration */ /** WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); wp_reset_vars( array( 'action', 'user_id', 'wp_http_referer' ) ); $user_id = (int) $user_id; $current_user = wp_get_current_user(); if ( ! defined( 'IS_PROFILE_PAGE' ) ) define( 'IS_PROFILE_PAGE', ( $user_id == $current_user->ID ) ); if ( ! $user_id && IS_PROFILE_PAGE ) $user_id = $current_user->ID; elseif ( ! $user_id && ! IS_PROFILE_PAGE ) wp_die(__( 'Invalid user ID.' ) ); elseif ( ! get_userdata( $user_id ) ) wp_die( __('Invalid user ID.') ); wp_enqueue_script('user-profile'); $title = IS_PROFILE_PAGE ? __('Profile') : __('Edit User'); if ( current_user_can('edit_users') && !IS_PROFILE_PAGE ) $submenu_file = 'users.php'; else $submenu_file = 'profile.php'; if ( current_user_can('edit_users') && !is_user_admin() ) $parent_file = 'users.php'; else $parent_file = 'profile.php'; $profile_help = '<p>' . __('Your profile contains information about you (your &#8220;account&#8221;) as well as some personal options related to using WordPress.') . '</p>' . '<p>' . __('You can change your password, turn on keyboard shortcuts, change the color scheme of your WordPress administration screens, and turn off the WYSIWYG (Visual) editor, among other things. You can hide the Toolbar (formerly called the Admin Bar) from the front end of your site, however it cannot be disabled on the admin screens.') . '</p>' . '<p>' . __('Your username cannot be changed, but you can use other fields to enter your real name or a nickname, and change which name to display on your posts.') . '</p>' . '<p>' . __('Required fields are indicated; the rest are optional. Profile information will only be displayed if your theme is set up to do so.') . '</p>' . '<p>' . __('Remember to click the Update Profile button when you are finished.') . '</p>'; get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => $profile_help, ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Users_Your_Profile_Screen" target="_blank">Documentation on User Profiles</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); $wp_http_referer = remove_query_arg(array('update', 'delete_count'), $wp_http_referer ); $user_can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ); /** * Optional SSL preference that can be turned on by hooking to the 'personal_options' action. * * @since 2.7.0 * * @param object $user User data object */ function use_ssl_preference($user) { ?> <tr> <th scope="row"><?php _e('Use https')?></th> <td><label for="use_ssl"><input name="use_ssl" type="checkbox" id="use_ssl" value="1" <?php checked('1', $user->use_ssl); ?> /> <?php _e('Always use https when visiting the admin'); ?></label></td> </tr> <?php } /** * Filter whether to allow administrators on Multisite to edit every user. * * Enabling the user editing form via this filter also hinges on the user holding * the 'manage_network_users' cap, and the logged-in user not matching the user * profile open for editing. * * The filter was introduced to replace the EDIT_ANY_USER constant. * * @since 3.0.0 * * @param bool $allow Whether to allow editing of any user. Default true. */ if ( is_multisite() && ! current_user_can( 'manage_network_users' ) && $user_id != $current_user->ID && ! apply_filters( 'enable_edit_any_user_configuration', true ) ) { wp_die( __( 'You do not have permission to edit this user.' ) ); } // Execute confirmed email change. See send_confirmation_on_profile_email(). if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) { $new_email = get_option( $current_user->ID . '_new_email' ); if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) { $user = new stdClass; $user->ID = $current_user->ID; $user->user_email = esc_html( trim( $new_email[ 'newemail' ] ) ); if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) ); wp_update_user( $user ); delete_option( $current_user->ID . '_new_email' ); wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) ); die(); } } elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' == $_GET['dismiss'] ) { delete_option( $current_user->ID . '_new_email' ); wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) ); die(); } switch ($action) { case 'update': check_admin_referer('update-user_' . $user_id); if ( !current_user_can('edit_user', $user_id) ) wp_die(__('You do not have permission to edit this user.')); if ( IS_PROFILE_PAGE ) { /** * Fires before the page loads on the 'Your Profile' editing screen. * * The action only fires if the current user is editing their own profile. * * @since 2.0.0 * * @param int $user_id The user ID. */ do_action( 'personal_options_update', $user_id ); } else { /** * Fires before the page loads on the 'Edit User' screen. * * @since 2.7.0 * * @param int $user_id The user ID. */ do_action( 'edit_user_profile_update', $user_id ); } if ( !is_multisite() ) { $errors = edit_user($user_id); } else { $user = get_userdata( $user_id ); // Update the email address in signups, if present. if ( $user->user_login && isset( $_POST[ 'email' ] ) && is_email( $_POST[ 'email' ] ) && $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $user->user_login ) ) ) $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $_POST[ 'email' ], $user_login ) ); // We must delete the user from the current blog if WP added them after editing. $delete_role = false; $blog_prefix = $wpdb->get_blog_prefix(); if ( $user_id != $current_user->ID ) { $cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$user_id}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" ); if ( !is_network_admin() && null == $cap && $_POST[ 'role' ] == '' ) { $_POST[ 'role' ] = 'contributor'; $delete_role = true; } } if ( !isset( $errors ) || ( isset( $errors ) && is_object( $errors ) && false == $errors->get_error_codes() ) ) $errors = edit_user($user_id); if ( $delete_role ) // stops users being added to current blog when they are edited delete_user_meta( $user_id, $blog_prefix . 'capabilities' ); if ( is_multisite() && is_network_admin() && !IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && !isset($super_admins) && empty( $_POST['super_admin'] ) == is_super_admin( $user_id ) ) empty( $_POST['super_admin'] ) ? revoke_super_admin( $user_id ) : grant_super_admin( $user_id ); } if ( !is_wp_error( $errors ) ) { $redirect = add_query_arg( 'updated', true, get_edit_user_link( $user_id ) ); if ( $wp_http_referer ) $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect); wp_redirect($redirect); exit; } default: $profileuser = get_user_to_edit($user_id); if ( !current_user_can('edit_user', $user_id) ) wp_die(__('You do not have permission to edit this user.')); include (ABSPATH . 'wp-admin/admin-header.php'); ?> <?php if ( !IS_PROFILE_PAGE && is_super_admin( $profileuser->ID ) && current_user_can( 'manage_network_options' ) ) { ?> <div class="updated"><p><strong><?php _e('Important:'); ?></strong> <?php _e('This user has super admin privileges.'); ?></p></div> <?php } ?> <?php if ( isset($_GET['updated']) ) : ?> <div id="message" class="updated"> <?php if ( IS_PROFILE_PAGE ) : ?> <p><strong><?php _e('Profile updated.') ?></strong></p> <?php else: ?> <p><strong><?php _e('User updated.') ?></strong></p> <?php endif; ?> <?php if ( $wp_http_referer && !IS_PROFILE_PAGE ) : ?> <p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php _e('&larr; Back to Users'); ?></a></p> <?php endif; ?> </div> <?php endif; ?> <?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?> <div class="error"><p><?php echo implode( "</p>\n<p>", $errors->get_error_messages() ); ?></p></div> <?php endif; ?> <div class="wrap" id="profile-page"> <h2> <?php echo esc_html( $title ); if ( ! IS_PROFILE_PAGE ) { if ( current_user_can( 'create_users' ) ) { ?> <a href="user-new.php" class="add-new-h2"><?php echo esc_html_x( 'Add New', 'user' ); ?></a> <?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?> <a href="user-new.php" class="add-new-h2"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a> <?php } } ?> </h2> <?php /** * Fires inside the your-profile form tag on the user editing screen. * * @since 3.0.0 */ ?> <form id="your-profile" action="<?php echo esc_url( self_admin_url( IS_PROFILE_PAGE ? 'profile.php' : 'user-edit.php' ) ); ?>" method="post"<?php do_action( 'user_edit_form_tag' ); ?>> <?php wp_nonce_field('update-user_' . $user_id) ?> <?php if ( $wp_http_referer ) : ?> <input type="hidden" name="wp_http_referer" value="<?php echo esc_url($wp_http_referer); ?>" /> <?php endif; ?> <p> <input type="hidden" name="from" value="profile" /> <input type="hidden" name="checkuser_id" value="<?php echo get_current_user_id(); ?>" /> </p> <h3><?php _e('Personal Options'); ?></h3> <table class="form-table"> <?php if ( ! ( IS_PROFILE_PAGE && ! $user_can_edit ) ) : ?> <tr> <th scope="row"><?php _e('Visual Editor')?></th> <td><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php if ( ! empty( $profileuser->rich_editing ) ) checked( 'false', $profileuser->rich_editing ); ?> /> <?php _e( 'Disable the visual editor when writing' ); ?></label></td> </tr> <?php endif; ?> <?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) : ?> <tr> <th scope="row"><?php _e('Admin Color Scheme')?></th> <?php /** * Fires in the 'Admin Color Scheme' section of the user editing screen. * * The section is only enabled if a callback is hooked to the action, * and if there is more than one defined color scheme for the admin. * * @since 3.0.0 */ ?> <td><?php do_action( 'admin_color_scheme_picker', $user_id ); ?></td> </tr> <?php endif; // $_wp_admin_css_colors if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?> <tr> <th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th> <td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( ! empty( $profileuser->comment_shortcuts ) ) checked( 'true', $profileuser->comment_shortcuts ); ?> /> <?php _e('Enable keyboard shortcuts for comment moderation.'); ?></label> <?php _e('<a href="http://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">More information</a>'); ?></td> </tr> <?php endif; ?> <tr class="show-admin-bar"> <th scope="row"><?php _e('Toolbar')?></th> <td><fieldset><legend class="screen-reader-text"><span><?php _e('Toolbar') ?></span></legend> <label for="admin_bar_front"> <input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked( _get_admin_bar_pref( 'front', $profileuser->ID ) ); ?> /> <?php _e( 'Show Toolbar when viewing site' ); ?></label><br /> </fieldset> </td> </tr> <?php /** * Fires at the end of the 'Personal Options' settings table on the user editing screen. * * @since 2.7.0 * * @param WP_User $profileuser The current WP_User object. */ do_action( 'personal_options', $profileuser ); ?> </table> <?php if ( IS_PROFILE_PAGE ) { /** * Fires after the 'Personal Options' settings table on the 'Your Profile' editing screen. * * The action only fires if the current user is editing their own profile. * * @since 2.0.0 * * @param WP_User $profileuser The current WP_User object. */ do_action( 'profile_personal_options', $profileuser ); } ?> <h3><?php _e('Name') ?></h3> <table class="form-table"> <tr> <th><label for="user_login"><?php _e('Username'); ?></label></th> <td><input type="text" name="user_login" id="user_login" value="<?php echo esc_attr($profileuser->user_login); ?>" disabled="disabled" class="regular-text" /> <span class="description"><?php _e('Usernames cannot be changed.'); ?></span></td> </tr> <?php if ( !IS_PROFILE_PAGE && !is_network_admin() ) : ?> <tr><th><label for="role"><?php _e('Role') ?></label></th> <td><select name="role" id="role"> <?php // Compare user role against currently editable roles $user_roles = array_intersect( array_values( $profileuser->roles ), array_keys( get_editable_roles() ) ); $user_role = array_shift( $user_roles ); // print the full list of roles with the primary one selected. wp_dropdown_roles($user_role); // print the 'no role' option. Make it selected if the user has no role yet. if ( $user_role ) echo '<option value="">' . __('&mdash; No role for this site &mdash;') . '</option>'; else echo '<option value="" selected="selected">' . __('&mdash; No role for this site &mdash;') . '</option>'; ?> </select></td></tr> <?php endif; //!IS_PROFILE_PAGE if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && !isset($super_admins) ) { ?> <tr><th><?php _e('Super Admin'); ?></th> <td> <?php if ( $profileuser->user_email != get_site_option( 'admin_email' ) || ! is_super_admin( $profileuser->ID ) ) : ?> <p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profileuser->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.' ); ?></label></p> <?php else : ?> <p><?php _e( 'Super admin privileges cannot be removed because this user has the network admin email.' ); ?></p> <?php endif; ?> </td></tr> <?php } ?> <tr> <th><label for="first_name"><?php _e('First Name') ?></label></th> <td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr($profileuser->first_name) ?>" class="regular-text" /></td> </tr> <tr> <th><label for="last_name"><?php _e('Last Name') ?></label></th> <td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr($profileuser->last_name) ?>" class="regular-text" /></td> </tr> <tr> <th><label for="nickname"><?php _e('Nickname'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th> <td><input type="text" name="nickname" id="nickname" value="<?php echo esc_attr($profileuser->nickname) ?>" class="regular-text" /></td> </tr> <tr> <th><label for="display_name"><?php _e('Display name publicly as') ?></label></th> <td> <select name="display_name" id="display_name"> <?php $public_display = array(); $public_display['display_nickname'] = $profileuser->nickname; $public_display['display_username'] = $profileuser->user_login; if ( !empty($profileuser->first_name) ) $public_display['display_firstname'] = $profileuser->first_name; if ( !empty($profileuser->last_name) ) $public_display['display_lastname'] = $profileuser->last_name; if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) { $public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name; $public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name; } if ( !in_array( $profileuser->display_name, $public_display ) ) // Only add this if it isn't duplicated elsewhere $public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display; $public_display = array_map( 'trim', $public_display ); $public_display = array_unique( $public_display ); foreach ( $public_display as $id => $item ) { ?> <option <?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option> <?php } ?> </select> </td> </tr> </table> <h3><?php _e('Contact Info') ?></h3> <table class="form-table"> <tr> <th><label for="email"><?php _e('E-mail'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th> <td><input type="text" name="email" id="email" value="<?php echo esc_attr($profileuser->user_email) ?>" class="regular-text ltr" /> <?php $new_email = get_option( $current_user->ID . '_new_email' ); if ( $new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID ) : ?> <div class="updated inline"> <p><?php printf( __('There is a pending change of your e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), $new_email['newemail'], esc_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ) ) ); ?></p> </div> <?php endif; ?> </td> </tr> <tr> <th><label for="url"><?php _e('Website') ?></label></th> <td><input type="text" name="url" id="url" value="<?php echo esc_attr($profileuser->user_url) ?>" class="regular-text code" /></td> </tr> <?php foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) { ?> <tr> <?php /** * Filter a user contactmethod label. * * The dynamic portion of the filter hook, $name, refers to * each of the keys in the contactmethods array. * * @since 2.9.0 * * @param string $desc The translatable label for the contactmethod. */ ?> <th><label for="<?php echo $name; ?>"><?php echo apply_filters( "user_{$name}_label", $desc ); ?></label></th> <td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td> </tr> <?php } ?> </table> <h3><?php IS_PROFILE_PAGE ? _e('About Yourself') : _e('About the user'); ?></h3> <table class="form-table"> <tr> <th><label for="description"><?php _e('Biographical Info'); ?></label></th> <td><textarea name="description" id="description" rows="5" cols="30"><?php echo $profileuser->description; // textarea_escaped ?></textarea><br /> <span class="description"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></span></td> </tr> <?php /** This filter is documented in wp-admin/user-new.php */ $show_password_fields = apply_filters( 'show_password_fields', true, $profileuser ); if ( $show_password_fields ) : ?> <tr id="password"> <th><label for="pass1"><?php _e( 'New Password' ); ?></label></th> <td> <input class="hidden" value=" " /><!-- #24364 workaround --> <input type="password" name="pass1" id="pass1" class="regular-text" size="16" value="" autocomplete="off" /><br /> <span class="description"><?php _e( 'If you would like to change the password type a new one. Otherwise leave this blank.' ); ?></span> </td> </tr> <tr> <th scope="row"><label for="pass2"><?php _e( 'Repeat New Password' ); ?></label></th> <td> <input name="pass2" type="password" id="pass2" class="regular-text" size="16" value="" autocomplete="off" /><br /> <span class="description" for="pass2"><?php _e( 'Type your new password again.' ); ?></span> <br /> <div id="pass-strength-result"><?php _e( 'Strength indicator' ); ?></div> <p class="description indicator-hint"><?php _e( 'Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ &amp; ).' ); ?></p> </td> </tr> <?php endif; ?> </table> <?php if ( IS_PROFILE_PAGE ) { /** * Fires after the 'About Yourself' settings table on the 'Your Profile' editing screen. * * The action only fires if the current user is editing their own profile. * * @since 2.0.0 * * @param WP_User $profileuser The current WP_User object. */ do_action( 'show_user_profile', $profileuser ); } else { /** * Fires after the 'About the User' settings table on the 'Edit User' screen. * * @since 2.0.0 * * @param WP_User $profileuser The current WP_User object. */ do_action( 'edit_user_profile', $profileuser ); } ?> <?php /** * Filter whether to display additional capabilities for the user. * * The 'Additional Capabilities' section will only be enabled if * the number of the user's capabilities exceeds their number of * of roles. * * @since 2.8.0 * * @param bool $enable Whether to display the capabilities. Default true. * @param WP_User $profileuser The current WP_User object. */ if ( count( $profileuser->caps ) > count( $profileuser->roles ) && apply_filters( 'additional_capabilities_display', true, $profileuser ) ) : ?> <h3><?php _e( 'Additional Capabilities' ); ?></h3> <table class="form-table"> <tr> <th scope="row"><?php _e( 'Capabilities' ); ?></th> <td> <?php $output = ''; foreach ( $profileuser->caps as $cap => $value ) { if ( ! $wp_roles->is_role( $cap ) ) { if ( '' != $output ) $output .= ', '; $output .= $value ? $cap : sprintf( __( 'Denied: %s' ), $cap ); } } echo $output; ?> </td> </tr> </table> <?php endif; ?> <input type="hidden" name="action" value="update" /> <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr($user_id); ?>" /> <?php submit_button( IS_PROFILE_PAGE ? __('Update Profile') : __('Update User') ); ?> </form> </div> <?php break; } ?> <script type="text/javascript"> if (window.location.hash == '#password') { document.getElementById('pass1').focus(); } </script> <?php include( ABSPATH . 'wp-admin/admin-footer.php');
01-wordpress-paypal
trunk/wp-admin/user-edit.php
PHP
gpl3
21,761
<?php /** * Manage media uploaded file. * * There are many filters in here for media. Plugins can extend functionality * by hooking into the filters. * * @package WordPress * @subpackage Administration */ /** Load WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); if (!current_user_can('upload_files')) wp_die(__('You do not have permission to upload files.')); wp_enqueue_script('plupload-handlers'); $post_id = 0; if ( isset( $_REQUEST['post_id'] ) ) { $post_id = absint( $_REQUEST['post_id'] ); if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) $post_id = 0; } if ( $_POST ) { $location = 'upload.php'; if ( isset($_POST['html-upload']) && !empty($_FILES) ) { check_admin_referer('media-form'); // Upload File button was clicked $id = media_handle_upload( 'async-upload', $post_id ); if ( is_wp_error( $id ) ) $location .= '?message=3'; } wp_redirect( admin_url( $location ) ); exit; } $title = __('Upload New Media'); $parent_file = 'upload.php'; get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('You can upload media files here without creating a post first. This allows you to upload files to use with posts and pages later and/or to get a web link for a particular file that you can share. There are three options for uploading files:') . '</p>' . '<ul>' . '<li>' . __('<strong>Drag and drop</strong> your files into the area below. Multiple files are allowed.') . '</li>' . '<li>' . __('Clicking <strong>Select Files</strong> opens a navigation window showing you files in your operating system. Selecting <strong>Open</strong> after clicking on the file you want activates a progress bar on the uploader screen.') . '</li>' . '<li>' . __('Revert to the <strong>Browser Uploader</strong> by clicking the link below the drag and drop box.') . '</li>' . '</ul>' ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Media_Add_New_Screen" target="_blank">Documentation on Uploading Media Files</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); require_once( ABSPATH . 'wp-admin/admin-header.php' ); $form_class = 'media-upload-form type-form validate'; if ( get_user_setting('uploader') || isset( $_GET['browser-uploader'] ) ) $form_class .= ' html-uploader'; ?> <div class="wrap"> <h2><?php echo esc_html( $title ); ?></h2> <form enctype="multipart/form-data" method="post" action="<?php echo admin_url('media-new.php'); ?>" class="<?php echo esc_attr( $form_class ); ?>" id="file-form"> <?php media_upload_form(); ?> <script type="text/javascript"> var post_id = <?php echo $post_id; ?>, shortform = 3; </script> <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" /> <?php wp_nonce_field('media-form'); ?> <div id="media-items" class="hide-if-no-js"></div> </form> </div> <?php include( ABSPATH . 'wp-admin/admin-footer.php' );
01-wordpress-paypal
trunk/wp-admin/media-new.php
PHP
gpl3
3,137
<?php /** * Import WordPress Administration Screen * * @package WordPress * @subpackage Administration */ define('WP_LOAD_IMPORTERS', true); /** Load WordPress Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); if ( !current_user_can('import') ) wp_die(__('You do not have sufficient permissions to import content in this site.')); $title = __('Import'); get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.') . '</p>' . '<p>' . __('In previous versions of WordPress, all importers were built-in. They have been turned into plugins since most people only use them once or infrequently.') . '</p>', ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Tools_Import_Screen" target="_blank">Documentation on Import</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); if ( current_user_can( 'install_plugins' ) ) $popular_importers = wp_get_popular_importers(); else $popular_importers = array(); // Detect and redirect invalid importers like 'movabletype', which is registered as 'mt' if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) { $importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id']; if ( $importer_id != $_GET['invalid'] ) { // Prevent redirect loops. wp_redirect( admin_url( 'admin.php?import=' . $importer_id ) ); exit; } unset( $importer_id ); } add_thickbox(); wp_enqueue_script( 'plugin-install' ); require_once( ABSPATH . 'wp-admin/admin-header.php' ); $parent_file = 'tools.php'; ?> <div class="wrap"> <h2><?php echo esc_html( $title ); ?></h2> <?php if ( ! empty( $_GET['invalid'] ) ) : ?> <div class="error"><p><strong><?php _e('ERROR:')?></strong> <?php printf( __('The <strong>%s</strong> importer is invalid or is not installed.'), esc_html( $_GET['invalid'] ) ); ?></p></div> <?php endif; ?> <p><?php _e('If you have posts or comments in another system, WordPress can import those into this site. To get started, choose a system to import from below:'); ?></p> <?php $importers = get_importers(); // If a popular importer is not registered, create a dummy registration that links to the plugin installer. foreach ( $popular_importers as $pop_importer => $pop_data ) { if ( isset( $importers[ $pop_importer ] ) ) continue; if ( isset( $importers[ $pop_data['importer-id'] ] ) ) continue; $importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] ); } if ( empty( $importers ) ) { echo '<p>' . __('No importers are available.') . '</p>'; // TODO: make more helpful } else { uasort( $importers, '_usort_by_first_member' ); ?> <table class="widefat importers"> <?php $alt = ''; foreach ($importers as $importer_id => $data) { $action = ''; if ( isset( $data['install'] ) ) { $plugin_slug = $data['install']; if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) { // Looks like Importer is installed, But not active $plugins = get_plugins( '/' . $plugin_slug ); if ( !empty($plugins) ) { $keys = array_keys($plugins); $plugin_file = $plugin_slug . '/' . $keys[0]; $action = '<a href="' . esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $plugin_file . '&from=import'), 'activate-plugin_' . $plugin_file)) . '"title="' . esc_attr__('Activate importer') . '"">' . $data[0] . '</a>'; } } if ( empty($action) ) { if ( is_main_site() ) { $action = '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . '&from=import&TB_iframe=true&width=600&height=550' ) ) . '" class="thickbox" title="' . esc_attr__('Install importer') . '">' . $data[0] . '</a>'; } else { $action = $data[0]; $data[1] = sprintf( __( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ), get_admin_url( $current_site->blog_id, 'import.php' ) ); } } } else { $action = "<a href='" . esc_url( "admin.php?import=$importer_id" ) . "' title='" . esc_attr( wptexturize( strip_tags( $data[1] ) ) ) ."'>{$data[0]}</a>"; } $alt = $alt ? '' : ' class="alternate"'; echo " <tr$alt> <td class='import-system row-title'>$action</td> <td class='desc'>{$data[1]}</td> </tr>"; } ?> </table> <?php } if ( current_user_can('install_plugins') ) echo '<p>' . sprintf( __('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url( network_admin_url( 'plugin-install.php?tab=search&type=tag&s=importer' ) ) ) . '</p>'; ?> </div> <?php include( ABSPATH . 'wp-admin/admin-footer.php' );
01-wordpress-paypal
trunk/wp-admin/import.php
PHP
gpl3
5,265
<?php /** * Multisite administration panel. * * @package WordPress * @subpackage Multisite * @since 3.0.0 */ require_once( dirname( __FILE__ ) . '/admin.php' ); wp_redirect( network_admin_url() ); exit;
01-wordpress-paypal
trunk/wp-admin/ms-admin.php
PHP
gpl3
211
<?php /** * WordPress Administration for Navigation Menus * Interface functions * * @version 2.0.0 * * @package WordPress * @subpackage Administration */ /** Load WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); // Load all the nav menu interface functions require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' ); if ( ! current_theme_supports( 'menus' ) && ! current_theme_supports( 'widgets' ) ) wp_die( __( 'Your theme does not support navigation menus or widgets.' ) ); // Permissions Check if ( ! current_user_can('edit_theme_options') ) wp_die( __( 'Cheatin&#8217; uh?' ) ); wp_enqueue_script( 'nav-menu' ); if ( wp_is_mobile() ) wp_enqueue_script( 'jquery-touch-punch' ); // Container for any messages displayed to the user $messages = array(); // Container that stores the name of the active menu $nav_menu_selected_title = ''; // The menu id of the current menu being edited $nav_menu_selected_id = isset( $_REQUEST['menu'] ) ? (int) $_REQUEST['menu'] : 0; // Get existing menu locations assignments $locations = get_registered_nav_menus(); $menu_locations = get_nav_menu_locations(); $num_locations = count( array_keys( $locations ) ); // Allowed actions: add, update, delete $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'edit'; switch ( $action ) { case 'add-menu-item': check_admin_referer( 'add-menu_item', 'menu-settings-column-nonce' ); if ( isset( $_REQUEST['nav-menu-locations'] ) ) set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_REQUEST['menu-locations'] ) ); elseif ( isset( $_REQUEST['menu-item'] ) ) wp_save_nav_menu_items( $nav_menu_selected_id, $_REQUEST['menu-item'] ); break; case 'move-down-menu-item' : // moving down a menu item is the same as moving up the next in order check_admin_referer( 'move-menu_item' ); $menu_item_id = isset( $_REQUEST['menu-item'] ) ? (int) $_REQUEST['menu-item'] : 0; if ( is_nav_menu_item( $menu_item_id ) ) { $menus = isset( $_REQUEST['menu'] ) ? array( (int) $_REQUEST['menu'] ) : wp_get_object_terms( $menu_item_id, 'nav_menu', array( 'fields' => 'ids' ) ); if ( ! is_wp_error( $menus ) && ! empty( $menus[0] ) ) { $menu_id = (int) $menus[0]; $ordered_menu_items = wp_get_nav_menu_items( $menu_id ); $menu_item_data = (array) wp_setup_nav_menu_item( get_post( $menu_item_id ) ); // set up the data we need in one pass through the array of menu items $dbids_to_orders = array(); $orders_to_dbids = array(); foreach( (array) $ordered_menu_items as $ordered_menu_item_object ) { if ( isset( $ordered_menu_item_object->ID ) ) { if ( isset( $ordered_menu_item_object->menu_order ) ) { $dbids_to_orders[$ordered_menu_item_object->ID] = $ordered_menu_item_object->menu_order; $orders_to_dbids[$ordered_menu_item_object->menu_order] = $ordered_menu_item_object->ID; } } } // get next in order if ( isset( $orders_to_dbids[$dbids_to_orders[$menu_item_id] + 1] ) ) { $next_item_id = $orders_to_dbids[$dbids_to_orders[$menu_item_id] + 1]; $next_item_data = (array) wp_setup_nav_menu_item( get_post( $next_item_id ) ); // if not siblings of same parent, bubble menu item up but keep order if ( ! empty( $menu_item_data['menu_item_parent'] ) && ( empty( $next_item_data['menu_item_parent'] ) || $next_item_data['menu_item_parent'] != $menu_item_data['menu_item_parent'] ) ) { $parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0; $parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) ); if ( ! is_wp_error( $parent_object ) ) { $parent_data = (array) $parent_object; $menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent']; update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); } // make menu item a child of its next sibling } else { $next_item_data['menu_order'] = $next_item_data['menu_order'] - 1; $menu_item_data['menu_order'] = $menu_item_data['menu_order'] + 1; $menu_item_data['menu_item_parent'] = $next_item_data['ID']; update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); wp_update_post($menu_item_data); wp_update_post($next_item_data); } // the item is last but still has a parent, so bubble up } elseif ( ! empty( $menu_item_data['menu_item_parent'] ) && in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ) { $menu_item_data['menu_item_parent'] = (int) get_post_meta( $menu_item_data['menu_item_parent'], '_menu_item_menu_item_parent', true); update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); } } } break; case 'move-up-menu-item' : check_admin_referer( 'move-menu_item' ); $menu_item_id = isset( $_REQUEST['menu-item'] ) ? (int) $_REQUEST['menu-item'] : 0; if ( is_nav_menu_item( $menu_item_id ) ) { $menus = isset( $_REQUEST['menu'] ) ? array( (int) $_REQUEST['menu'] ) : wp_get_object_terms( $menu_item_id, 'nav_menu', array( 'fields' => 'ids' ) ); if ( ! is_wp_error( $menus ) && ! empty( $menus[0] ) ) { $menu_id = (int) $menus[0]; $ordered_menu_items = wp_get_nav_menu_items( $menu_id ); $menu_item_data = (array) wp_setup_nav_menu_item( get_post( $menu_item_id ) ); // set up the data we need in one pass through the array of menu items $dbids_to_orders = array(); $orders_to_dbids = array(); foreach( (array) $ordered_menu_items as $ordered_menu_item_object ) { if ( isset( $ordered_menu_item_object->ID ) ) { if ( isset( $ordered_menu_item_object->menu_order ) ) { $dbids_to_orders[$ordered_menu_item_object->ID] = $ordered_menu_item_object->menu_order; $orders_to_dbids[$ordered_menu_item_object->menu_order] = $ordered_menu_item_object->ID; } } } // if this menu item is not first if ( ! empty( $dbids_to_orders[$menu_item_id] ) && ! empty( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) ) { // if this menu item is a child of the previous if ( ! empty( $menu_item_data['menu_item_parent'] ) && in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ) ) && isset( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) && ( $menu_item_data['menu_item_parent'] == $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) ) { $parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0; $parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) ); if ( ! is_wp_error( $parent_object ) ) { $parent_data = (array) $parent_object; // if there is something before the parent and parent a child of it, make menu item a child also of it if ( ! empty( $dbids_to_orders[$parent_db_id] ) && ! empty( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1] ) && ! empty( $parent_data['menu_item_parent'] ) ) { $menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent']; // else if there is something before parent and parent not a child of it, make menu item a child of that something's parent } elseif ( ! empty( $dbids_to_orders[$parent_db_id] ) && ! empty( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1] ) ) { $_possible_parent_id = (int) get_post_meta( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1], '_menu_item_menu_item_parent', true); if ( in_array( $_possible_parent_id, array_keys( $dbids_to_orders ) ) ) $menu_item_data['menu_item_parent'] = $_possible_parent_id; else $menu_item_data['menu_item_parent'] = 0; // else there isn't something before the parent } else { $menu_item_data['menu_item_parent'] = 0; } // set former parent's [menu_order] to that of menu-item's $parent_data['menu_order'] = $parent_data['menu_order'] + 1; // set menu-item's [menu_order] to that of former parent $menu_item_data['menu_order'] = $menu_item_data['menu_order'] - 1; // save changes update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); wp_update_post($menu_item_data); wp_update_post($parent_data); } // else this menu item is not a child of the previous } elseif ( empty( $menu_item_data['menu_order'] ) || empty( $menu_item_data['menu_item_parent'] ) || ! in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ) ) || empty( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) || $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] != $menu_item_data['menu_item_parent'] ) { // just make it a child of the previous; keep the order $menu_item_data['menu_item_parent'] = (int) $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1]; update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); wp_update_post($menu_item_data); } } } } break; case 'delete-menu-item': $menu_item_id = (int) $_REQUEST['menu-item']; check_admin_referer( 'delete-menu_item_' . $menu_item_id ); if ( is_nav_menu_item( $menu_item_id ) && wp_delete_post( $menu_item_id, true ) ) $messages[] = '<div id="message" class="updated"><p>' . __('The menu item has been successfully deleted.') . '</p></div>'; break; case 'delete': check_admin_referer( 'delete-nav_menu-' . $nav_menu_selected_id ); if ( is_nav_menu( $nav_menu_selected_id ) ) { $deletion = wp_delete_nav_menu( $nav_menu_selected_id ); } else { // Reset the selected menu $nav_menu_selected_id = 0; unset( $_REQUEST['menu'] ); } if ( ! isset( $deletion ) ) break; if ( is_wp_error( $deletion ) ) $messages[] = '<div id="message" class="error"><p>' . $deletion->get_error_message() . '</p></div>'; else $messages[] = '<div id="message" class="updated"><p>' . __( 'The menu has been successfully deleted.' ) . '</p></div>'; break; case 'delete_menus': check_admin_referer( 'nav_menus_bulk_actions' ); foreach ( $_REQUEST['delete_menus'] as $menu_id_to_delete ) { if ( ! is_nav_menu( $menu_id_to_delete ) ) continue; $deletion = wp_delete_nav_menu( $menu_id_to_delete ); if ( is_wp_error( $deletion ) ) { $messages[] = '<div id="message" class="error"><p>' . $deletion->get_error_message() . '</p></div>'; $deletion_error = true; } } if ( empty( $deletion_error ) ) $messages[] = '<div id="message" class="updated"><p>' . __( 'Selected menus have been successfully deleted.' ) . '</p></div>'; break; case 'update': check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' ); // Remove menu locations that have been unchecked foreach ( $locations as $location => $description ) { if ( ( empty( $_POST['menu-locations'] ) || empty( $_POST['menu-locations'][ $location ] ) ) && isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id ) unset( $menu_locations[ $location ] ); } // Merge new and existing menu locations if any new ones are set if ( isset( $_POST['menu-locations'] ) ) { $new_menu_locations = array_map( 'absint', $_POST['menu-locations'] ); $menu_locations = array_merge( $menu_locations, $new_menu_locations ); } // Set menu locations set_theme_mod( 'nav_menu_locations', $menu_locations ); // Add Menu if ( 0 == $nav_menu_selected_id ) { $new_menu_title = trim( esc_html( $_POST['menu-name'] ) ); if ( $new_menu_title ) { $_nav_menu_selected_id = wp_update_nav_menu_object( 0, array('menu-name' => $new_menu_title) ); if ( is_wp_error( $_nav_menu_selected_id ) ) { $messages[] = '<div id="message" class="error"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>'; } else { $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id ); $nav_menu_selected_id = $_nav_menu_selected_id; $nav_menu_selected_title = $_menu_object->name; if ( isset( $_REQUEST['menu-item'] ) ) wp_save_nav_menu_items( $nav_menu_selected_id, absint( $_REQUEST['menu-item'] ) ); if ( isset( $_REQUEST['zero-menu-state'] ) ) { // If there are menu items, add them wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title ); // Auto-save nav_menu_locations $locations = get_nav_menu_locations(); foreach ( $locations as $location => $menu_id ) { $locations[ $location ] = $nav_menu_selected_id; break; // There should only be 1 } set_theme_mod( 'nav_menu_locations', $locations ); } if ( isset( $_REQUEST['use-location'] ) ) { $locations = get_registered_nav_menus(); $menu_locations = get_nav_menu_locations(); if ( isset( $locations[ $_REQUEST['use-location'] ] ) ) $menu_locations[ $_REQUEST['use-location'] ] = $nav_menu_selected_id; set_theme_mod( 'nav_menu_locations', $menu_locations ); } // $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( '<strong>%s</strong> has been created.' ), $nav_menu_selected_title ) . '</p></div>'; wp_redirect( admin_url( 'nav-menus.php?menu=' . $_nav_menu_selected_id ) ); exit(); } } else { $messages[] = '<div id="message" class="error"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>'; } // Update existing menu } else { $_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id ); $menu_title = trim( esc_html( $_POST['menu-name'] ) ); if ( ! $menu_title ) { $messages[] = '<div id="message" class="error"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>'; $menu_title = $_menu_object->name; } if ( ! is_wp_error( $_menu_object ) ) { $_nav_menu_selected_id = wp_update_nav_menu_object( $nav_menu_selected_id, array( 'menu-name' => $menu_title ) ); if ( is_wp_error( $_nav_menu_selected_id ) ) { $_menu_object = $_nav_menu_selected_id; $messages[] = '<div id="message" class="error"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>'; } else { $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id ); $nav_menu_selected_title = $_menu_object->name; } } // Update menu items if ( ! is_wp_error( $_menu_object ) ) { $messages = array_merge( $messages, wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title ) ); } } break; case 'locations': if ( ! $num_locations ) { wp_redirect( admin_url( 'nav-menus.php' ) ); exit(); } add_filter( 'screen_options_show_screen', '__return_false' ); if ( isset( $_POST['menu-locations'] ) ) { check_admin_referer( 'save-menu-locations' ); $new_menu_locations = array_map( 'absint', $_POST['menu-locations'] ); $menu_locations = array_merge( $menu_locations, $new_menu_locations ); // Set menu locations set_theme_mod( 'nav_menu_locations', $menu_locations ); $messages[] = '<div id="message" class="updated"><p>' . __( 'Menu locations updated.' ) . '</p></div>'; } break; } // Get all nav menus $nav_menus = wp_get_nav_menus( array('orderby' => 'name') ); $menu_count = count( $nav_menus ); // Are we on the add new screen? $add_new_screen = ( isset( $_GET['menu'] ) && 0 == $_GET['menu'] ) ? true : false; $locations_screen = ( isset( $_GET['action'] ) && 'locations' == $_GET['action'] ) ? true : false; // If we have one theme location, and zero menus, we take them right into editing their first menu $page_count = wp_count_posts( 'page' ); $one_theme_location_no_menus = ( 1 == count( get_registered_nav_menus() ) && ! $add_new_screen && empty( $nav_menus ) && ! empty( $page_count->publish ) ) ? true : false; $nav_menus_l10n = array( 'oneThemeLocationNoMenus' => $one_theme_location_no_menus, 'moveUp' => __( 'Move up one' ), 'moveDown' => __( 'Move down one' ), 'moveToTop' => __( 'Move to the top' ), /* translators: %s: previous item name */ 'moveUnder' => __( 'Move under %s' ), /* translators: %s: previous item name */ 'moveOutFrom' => __( 'Move out from under %s' ), /* translators: %s: previous item name */ 'under' => __( 'Under %s' ), /* translators: %s: previous item name */ 'outFrom' => __( 'Out from under %s' ), /* translators: 1: item name, 2: item position, 3: total number of items */ 'menuFocus' => __( '%1$s. Menu item %2$d of %3$d.' ), /* translators: 1: item name, 2: item position, 3: parent item name */ 'subMenuFocus' => __( '%1$s. Sub item number %2$d under %3$s.' ), ); wp_localize_script( 'nav-menu', 'menus', $nav_menus_l10n ); // Redirect to add screen if there are no menus and this users has either zero, or more than 1 theme locations if ( 0 == $menu_count && ! $add_new_screen && ! $one_theme_location_no_menus ) wp_redirect( admin_url( 'nav-menus.php?action=edit&menu=0' ) ); // Get recently edited nav menu $recently_edited = absint( get_user_option( 'nav_menu_recently_edited' ) ); if ( empty( $recently_edited ) && is_nav_menu( $nav_menu_selected_id ) ) $recently_edited = $nav_menu_selected_id; // Use $recently_edited if none are selected if ( empty( $nav_menu_selected_id ) && ! isset( $_GET['menu'] ) && is_nav_menu( $recently_edited ) ) $nav_menu_selected_id = $recently_edited; // On deletion of menu, if another menu exists, show it if ( ! $add_new_screen && 0 < $menu_count && isset( $_GET['action'] ) && 'delete' == $_GET['action'] ) $nav_menu_selected_id = $nav_menus[0]->term_id; // Set $nav_menu_selected_id to 0 if no menus if ( $one_theme_location_no_menus ) { $nav_menu_selected_id = 0; } elseif ( empty( $nav_menu_selected_id ) && ! empty( $nav_menus ) && ! $add_new_screen ) { // if we have no selection yet, and we have menus, set to the first one in the list $nav_menu_selected_id = $nav_menus[0]->term_id; } // Update the user's setting if ( $nav_menu_selected_id != $recently_edited && is_nav_menu( $nav_menu_selected_id ) ) update_user_meta( $current_user->ID, 'nav_menu_recently_edited', $nav_menu_selected_id ); // If there's a menu, get its name. if ( ! $nav_menu_selected_title && is_nav_menu( $nav_menu_selected_id ) ) { $_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id ); $nav_menu_selected_title = ! is_wp_error( $_menu_object ) ? $_menu_object->name : ''; } // Generate truncated menu names foreach( (array) $nav_menus as $key => $_nav_menu ) { $nav_menus[$key]->truncated_name = wp_html_excerpt( $_nav_menu->name, 40, '&hellip;' ); } // Retrieve menu locations if ( current_theme_supports( 'menus' ) ) { $locations = get_registered_nav_menus(); $menu_locations = get_nav_menu_locations(); } // Ensure the user will be able to scroll horizontally // by adding a class for the max menu depth. global $_wp_nav_menu_max_depth; $_wp_nav_menu_max_depth = 0; // Calling wp_get_nav_menu_to_edit generates $_wp_nav_menu_max_depth if ( is_nav_menu( $nav_menu_selected_id ) ) { $menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'post_status' => 'any' ) ); $edit_markup = wp_get_nav_menu_to_edit( $nav_menu_selected_id ); } function wp_nav_menu_max_depth($classes) { global $_wp_nav_menu_max_depth; return "$classes menu-max-depth-$_wp_nav_menu_max_depth"; } add_filter('admin_body_class', 'wp_nav_menu_max_depth'); wp_nav_menu_setup(); wp_initial_nav_menu_meta_boxes(); if ( ! current_theme_supports( 'menus' ) && ! $num_locations ) $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( 'Your theme does not natively support menus, but you can use them in sidebars by adding a &#8220;Custom Menu&#8221; widget on the <a href="%s">Widgets</a> screen.' ), admin_url( 'widgets.php' ) ) . '</p></div>'; if ( ! $locations_screen ) : // Main tab $overview = '<p>' . __( 'This screen is used for managing your custom navigation menus.' ) . '</p>'; $overview .= '<p>' . sprintf( __( 'Menus can be displayed in locations defined by your theme, even used in sidebars by adding a &#8220;Custom Menu&#8221; widget on the <a href="%1$s">Widgets</a> screen. If your theme does not support the custom menus feature (the default themes, %2$s and %3$s, do), you can learn about adding this support by following the Documentation link to the side.' ), admin_url( 'widgets.php' ), 'Twenty Fourteen', 'Twenty Thirteen' ) . '</p>'; $overview .= '<p>' . __( 'From this screen you can:' ) . '</p>'; $overview .= '<ul><li>' . __( 'Create, edit, and delete menus' ) . '</li>'; $overview .= '<li>' . __( 'Add, organize, and modify individual menu items' ) . '</li></ul>'; get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => $overview ) ); $menu_management = '<p>' . __( 'The menu management box at the top of the screen is used to control which menu is opened in the editor below.' ) . '</p>'; $menu_management .= '<ul><li>' . __( 'To edit an existing menu, <strong>choose a menu from the drop down and click Select</strong>' ) . '</li>'; $menu_management .= '<li>' . __( 'If you haven&#8217;t yet created any menus, <strong>click the &#8217;create a new menu&#8217; link</strong> to get started' ) . '</li></ul>'; $menu_management .= '<p>' . __( 'You can assign theme locations to individual menus by <strong>selecting the desired settings</strong> at the bottom of the menu editor. To assign menus to all theme locations at once, <strong>visit the Manage Locations tab</strong> at the top of the screen.' ) . '</p>'; get_current_screen()->add_help_tab( array( 'id' => 'menu-management', 'title' => __( 'Menu Management' ), 'content' => $menu_management ) ); $editing_menus = '<p>' . __( 'Each custom menu may contain a mix of links to pages, categories, custom URLs or other content types. Menu links are added by selecting items from the expanding boxes in the left-hand column below.' ) . '</p>'; $editing_menus .= '<p>' . __( '<strong>Clicking the arrow to the right of any menu item</strong> in the editor will reveal a standard group of settings. Additional settings such as link target, CSS classes, link relationships, and link descriptions can be enabled and disabled via the Screen Options tab.' ) . '</p>'; $editing_menus .= '<ul><li>' . __( 'Add one or several items at once by <strong>selecting the checkbox next to each item and clicking Add to Menu</strong>' ) . '</li>'; $editing_menus .= '<li>' . __( 'To add a custom link, <strong>expand the Links section, enter a URL and link text, and click Add to Menu</strong>' ) .'</li>'; $editing_menus .= '<li>' . __( 'To reorganize menu items, <strong>drag and drop items with your mouse or use your keyboard</strong>. Drag or move a menu item a little to the right to make it a submenu' ) . '</li>'; $editing_menus .= '<li>' . __( 'Delete a menu item by <strong>expanding it and clicking the Remove link</strong>' ) . '</li></ul>'; get_current_screen()->add_help_tab( array( 'id' => 'editing-menus', 'title' => __( 'Editing Menus' ), 'content' => $editing_menus ) ); else : // Locations Tab $locations_overview = '<p>' . __( 'This screen is used for globally assigning menus to locations defined by your theme.' ) . '</p>'; $locations_overview .= '<ul><li>' . __( 'To assign menus to one or more theme locations, <strong>select a menu from each location&#8217;s drop down.</strong> When you&#8217;re finished, <strong>click Save Changes</strong>' ) . '</li>'; $locations_overview .= '<li>' . __( 'To edit a menu currently assigned to a theme location, <strong>click the adjacent &#8217;Edit&#8217; link</strong>' ) . '</li>'; $locations_overview .= '<li>' . __( 'To add a new menu instead of assigning an existing one, <strong>click the &#8217;Use new menu&#8217; link</strong>. Your new menu will be automatically assigned to that theme location' ) . '</li></ul>'; get_current_screen()->add_help_tab( array( 'id' => 'locations-overview', 'title' => __( 'Overview' ), 'content' => $locations_overview ) ); endif; get_current_screen()->set_help_sidebar( '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Appearance_Menus_Screen" target="_blank">Documentation on Menus</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); // Get the admin header require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?> <div class="wrap"> <h2 class="nav-tab-wrapper"> <a href="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-tab<?php if ( ! isset( $_GET['action'] ) || isset( $_GET['action'] ) && 'locations' != $_GET['action'] ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Edit Menus' ); ?></a> <?php if ( $num_locations && $menu_count ) : ?> <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php if ( $locations_screen ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Manage Locations' ); ?></a> <?php endif; ?> </h2> <?php foreach( $messages as $message ) : echo $message . "\n"; endforeach; ?> <?php if ( $locations_screen ) : echo '<p>' . sprintf( _n( 'Your theme supports %s menu. Select which menu you would like to use.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) ) . '</p>'; ?> <div id="menu-locations-wrap"> <form method="post" action="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>"> <table class="widefat fixed" id="menu-locations-table"> <thead> <tr> <th scope="col" class="manage-column column-locations"><?php _e( 'Theme Location' ); ?></th> <th scope="col" class="manage-column column-menus"><?php _e( 'Assigned Menu' ); ?></th> </tr> </thead> <!--<tfoot> <tr> <th scope="col" class="manage-column column-locations"><?php _e( 'Theme Location' ); ?></th> <th scope="col" class="manage-column column-menus"><?php _e( 'Assigned Menu' ); ?></th> </tr> </tfoot>--> <tbody class="menu-locations"> <?php foreach ( $locations as $_location => $_name ) { ?> <tr id="menu-locations-row"> <td class="menu-location-title"><strong><?php echo $_name; ?></strong></td> <td class="menu-location-menus"> <select name="menu-locations[<?php echo $_location; ?>]" id="locations-<?php echo $_location; ?>"> <option value="0"><?php printf( '&mdash; %s &mdash;', esc_html__( 'Select a Menu' ) ); ?></option> <?php foreach ( $nav_menus as $menu ) : ?> <?php $selected = isset( $menu_locations[$_location] ) && $menu_locations[$_location] == $menu->term_id; ?> <option <?php if ( $selected ) echo 'data-orig="true"'; ?> <?php selected( $selected ); ?> value="<?php echo $menu->term_id; ?>"> <?php echo wp_html_excerpt( $menu->name, 40, '&hellip;' ); ?> </option> <?php endforeach; ?> </select> <div class="locations-row-links"> <?php if ( isset( $menu_locations[ $_location ] ) && 0 != $menu_locations[ $_location ] ) : ?> <span class="locations-edit-menu-link"> <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => $menu_locations[$_location] ), admin_url( 'nav-menus.php' ) ) ); ?>"> <?php _ex( 'Edit', 'menu' ); ?> </a> </span> <?php endif; ?> <span class="locations-add-menu-link"> <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0, 'use-location' => $_location ), admin_url( 'nav-menus.php' ) ) ); ?>"> <?php _ex( 'Use new menu', 'menu' ); ?> </a> </span> </div><!-- #locations-row-links --> </td><!-- .menu-location-menus --> </tr><!-- #menu-locations-row --> <?php } // foreach ?> </tbody> </table> <p class="button-controls"><?php submit_button( __( 'Save Changes' ), 'primary left', 'nav-menu-locations', false ); ?></p> <?php wp_nonce_field( 'save-menu-locations' ); ?> <input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> </form> </div><!-- #menu-locations-wrap --> <?php /** * Fires after the menu locations table is displayed. * * @since 3.6.0 */ do_action( 'after_menu_locations_table' ); ?> <?php else : ?> <div class="manage-menus"> <?php if ( $menu_count < 2 ) : ?> <span class="add-edit-menu-action"> <?php printf( __( 'Edit your menu below, or <a href="%s">create a new menu</a>.' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ) ); ?> </span><!-- /add-edit-menu-action --> <?php else : ?> <form method="get" action="<?php echo admin_url( 'nav-menus.php' ); ?>"> <input type="hidden" name="action" value="edit" /> <label for="menu" class="selected-menu"><?php _e( 'Select a menu to edit:' ); ?></label> <select name="menu" id="menu"> <?php if ( $add_new_screen ) : ?> <option value="0" selected="selected"><?php _e( '-- Select --' ); ?></option> <?php endif; ?> <?php foreach( (array) $nav_menus as $_nav_menu ) : ?> <option value="<?php echo esc_attr( $_nav_menu->term_id ); ?>" <?php selected( $_nav_menu->term_id, $nav_menu_selected_id ); ?>> <?php echo esc_html( $_nav_menu->truncated_name ) ; if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) { $locations_assigned_to_this_menu = array(); foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) { if ( isset( $locations[ $menu_location_key ] ) ) { $locations_assigned_to_this_menu[] = $locations[ $menu_location_key ]; } } /** * Filter the number of locations listed per menu in the drop-down select. * * @since 3.6.0 * * @param int $locations Number of menu locations to list. Default 3. */ $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) ); // Adds ellipses following the number of locations defined in $assigned_locations if ( ! empty( $assigned_locations ) ) { printf( ' (%1$s%2$s)', implode( ', ', $assigned_locations ), count( $locations_assigned_to_this_menu ) > count( $assigned_locations ) ? ' &hellip;' : '' ); } } ?> </option> <?php endforeach; ?> </select> <span class="submit-btn"><input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Select' ); ?>"></span> <span class="add-new-menu-action"> <?php printf( __( 'or <a href="%s">create a new menu</a>.' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ) ); ?> </span><!-- /add-new-menu-action --> </form> <?php endif; ?> </div><!-- /manage-menus --> <div id="nav-menus-frame"> <div id="menu-settings-column" class="metabox-holder<?php if ( isset( $_GET['menu'] ) && '0' == $_GET['menu'] ) { echo ' metabox-holder-disabled'; } ?>"> <div class="clear"></div> <form id="nav-menu-meta" action="" class="nav-menu-meta" method="post" enctype="multipart/form-data"> <input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> <input type="hidden" name="action" value="add-menu-item" /> <?php wp_nonce_field( 'add-menu_item', 'menu-settings-column-nonce' ); ?> <?php do_accordion_sections( 'nav-menus', 'side', null ); ?> </form> </div><!-- /#menu-settings-column --> <div id="menu-management-liquid"> <div id="menu-management"> <form id="update-nav-menu" action="" method="post" enctype="multipart/form-data"> <div class="menu-edit <?php if ( $add_new_screen ) echo 'blank-slate'; ?>"> <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); wp_nonce_field( 'update-nav_menu', 'update-nav-menu-nonce' ); if ( $one_theme_location_no_menus ) { ?> <input type="hidden" name="zero-menu-state" value="true" /> <?php } ?> <input type="hidden" name="action" value="update" /> <input type="hidden" name="menu" id="menu" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> <div id="nav-menu-header"> <div class="major-publishing-actions"> <label class="menu-name-label howto open-label" for="menu-name"> <span><?php _e( 'Menu Name' ); ?></span> <input name="menu-name" id="menu-name" type="text" class="menu-name regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e( 'Enter menu name here' ); ?>" value="<?php if ( $one_theme_location_no_menus ) _e( 'Menu 1' ); else echo esc_attr( $nav_menu_selected_title ); ?>" /> </label> <div class="publishing-action"> <?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_header' ) ); ?> </div><!-- END .publishing-action --> </div><!-- END .major-publishing-actions --> </div><!-- END .nav-menu-header --> <div id="post-body"> <div id="post-body-content"> <?php if ( ! $add_new_screen ) : ?> <h3><?php _e( 'Menu Structure' ); ?></h3> <?php $starter_copy = ( $one_theme_location_no_menus ) ? __( 'Edit your default menu by adding or removing items. Drag each item into the order you prefer. Click Create Menu to save your changes.' ) : __( 'Drag each item into the order you prefer. Click the arrow on the right of the item to reveal additional configuration options.' ); ?> <div class="drag-instructions post-body-plain" <?php if ( isset( $menu_items ) && 0 == count( $menu_items ) ) { ?>style="display: none;"<?php } ?>> <p><?php echo $starter_copy; ?></p> </div> <?php if ( isset( $edit_markup ) && ! is_wp_error( $edit_markup ) ) { echo $edit_markup; } else { ?> <ul class="menu" id="menu-to-edit"></ul> <?php } ?> <?php endif; ?> <?php if ( $add_new_screen ) : ?> <p class="post-body-plain"><?php _e( 'Give your menu a name above, then click Create Menu.' ); ?></p> <?php if ( isset( $_GET['use-location'] ) ) : ?> <input type="hidden" name="use-location" value="<?php echo esc_attr( $_GET['use-location'] ); ?>" /> <?php endif; ?> <?php endif; ?> <div class="menu-settings" <?php if ( $one_theme_location_no_menus ) { ?>style="display: none;"<?php } ?>> <h3><?php _e( 'Menu Settings' ); ?></h3> <?php if ( ! isset( $auto_add ) ) { $auto_add = get_option( 'nav_menu_options' ); if ( ! isset( $auto_add['auto_add'] ) ) $auto_add = false; elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'] ) ) $auto_add = true; else $auto_add = false; } ?> <dl class="auto-add-pages"> <dt class="howto"><?php _e( 'Auto add pages' ); ?></dt> <dd class="checkbox-input"><input type="checkbox"<?php checked( $auto_add ); ?> name="auto-add-pages" id="auto-add-pages" value="1" /> <label for="auto-add-pages"><?php printf( __('Automatically add new top-level pages to this menu' ), esc_url( admin_url( 'edit.php?post_type=page' ) ) ); ?></label></dd> </dl> <?php if ( current_theme_supports( 'menus' ) ) : ?> <dl class="menu-theme-locations"> <dt class="howto"><?php _e( 'Theme locations' ); ?></dt> <?php foreach ( $locations as $location => $description ) : ?> <dd class="checkbox-input"> <input type="checkbox"<?php checked( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id ); ?> name="menu-locations[<?php echo esc_attr( $location ); ?>]" id="locations-<?php echo esc_attr( $location ); ?>" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> <label for="locations-<?php echo esc_attr( $location ); ?>"><?php echo $description; ?></label> <?php if ( ! empty( $menu_locations[ $location ] ) && $menu_locations[ $location ] != $nav_menu_selected_id ) : ?> <span class="theme-location-set"> <?php printf( __( "(Currently set to: %s)" ), wp_get_nav_menu_object( $menu_locations[ $location ] )->name ); ?> </span> <?php endif; ?> </dd> <?php endforeach; ?> </dl> <?php endif; ?> </div> </div><!-- /#post-body-content --> </div><!-- /#post-body --> <div id="nav-menu-footer"> <div class="major-publishing-actions"> <?php if ( 0 != $menu_count && ! $add_new_screen ) : ?> <span class="delete-action"> <a class="submitdelete deletion menu-delete" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'menu' => $nav_menu_selected_id, admin_url() ) ), 'delete-nav_menu-' . $nav_menu_selected_id) ); ?>"><?php _e('Delete Menu'); ?></a> </span><!-- END .delete-action --> <?php endif; ?> <div class="publishing-action"> <?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_header' ) ); ?> </div><!-- END .publishing-action --> </div><!-- END .major-publishing-actions --> </div><!-- /#nav-menu-footer --> </div><!-- /.menu-edit --> </form><!-- /#update-nav-menu --> </div><!-- /#menu-management --> </div><!-- /#menu-management-liquid --> </div><!-- /#nav-menus-frame --> <?php endif; ?> </div><!-- /.wrap--> <?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
01-wordpress-paypal
trunk/wp-admin/nav-menus.php
PHP
gpl3
38,444
<?php /** * Comment Moderation Administration Screen. * * Redirects to edit-comments.php?comment_status=moderated. * * @package WordPress * @subpackage Administration */ require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' ); wp_redirect( admin_url('edit-comments.php?comment_status=moderated') ); exit;
01-wordpress-paypal
trunk/wp-admin/moderation.php
PHP
gpl3
320
<?php /** * Comment Management Screen * * @package WordPress * @subpackage Administration */ /** Load WordPress Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); $parent_file = 'edit-comments.php'; $submenu_file = 'edit-comments.php'; wp_reset_vars( array('action') ); if ( isset( $_POST['deletecomment'] ) ) $action = 'deletecomment'; if ( 'cdc' == $action ) $action = 'delete'; elseif ( 'mac' == $action ) $action = 'approve'; if ( isset( $_GET['dt'] ) ) { if ( 'spam' == $_GET['dt'] ) $action = 'spam'; elseif ( 'trash' == $_GET['dt'] ) $action = 'trash'; } /** * Display error message at bottom of comments. * * @param string $msg Error Message. Assumed to contain HTML and be sanitized. */ function comment_footer_die( $msg ) { echo "<div class='wrap'><p>$msg</p></div>"; include( ABSPATH . 'wp-admin/admin-footer.php' ); die; } switch( $action ) { case 'editcomment' : $title = __('Edit Comment'); get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __( 'You can edit the information left in a comment if needed. This is often useful when you notice that a commenter has made a typographical error.' ) . '</p>' . '<p>' . __( 'You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment.' ) . '</p>' ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . '<p>' . __( '<a href="http://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>' ) . '</p>' . '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' ); wp_enqueue_script('comment'); require_once( ABSPATH . 'wp-admin/admin-header.php' ); $comment_id = absint( $_GET['c'] ); if ( !$comment = get_comment( $comment_id ) ) comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'javascript:history.go(-1)') ); if ( !current_user_can( 'edit_comment', $comment_id ) ) comment_footer_die( __('You are not allowed to edit this comment.') ); if ( 'trash' == $comment->comment_approved ) comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') ); $comment = get_comment_to_edit( $comment_id ); include( ABSPATH . 'wp-admin/edit-form-comment.php' ); break; case 'delete' : case 'approve' : case 'trash' : case 'spam' : $title = __('Moderate Comment'); $comment_id = absint( $_GET['c'] ); if ( !$comment = get_comment_to_edit( $comment_id ) ) { wp_redirect( admin_url('edit-comments.php?error=1') ); die(); } if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) { wp_redirect( admin_url('edit-comments.php?error=2') ); die(); } // No need to re-approve/re-trash/re-spam a comment. if ( $action == str_replace( '1', 'approve', $comment->comment_approved ) ) { wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) ); die(); } require_once( ABSPATH . 'wp-admin/admin-header.php' ); $formaction = $action . 'comment'; $nonce_action = 'approve' == $action ? 'approve-comment_' : 'delete-comment_'; $nonce_action .= $comment_id; ?> <div class='wrap'> <div class="narrow"> <h2><?php echo esc_html( $title ); ?></h2> <?php switch ( $action ) { case 'spam' : $caution_msg = __('You are about to mark the following comment as spam:'); $button = __('Spam Comment'); break; case 'trash' : $caution_msg = __('You are about to move the following comment to the Trash:'); $button = __('Trash Comment'); break; case 'delete' : $caution_msg = __('You are about to delete the following comment:'); $button = __('Permanently Delete Comment'); break; default : $caution_msg = __('You are about to approve the following comment:'); $button = __('Approve Comment'); break; } if ( $comment->comment_approved != '0' ) { // if not unapproved $message = ''; switch ( $comment->comment_approved ) { case '1' : $message = __('This comment is currently approved.'); break; case 'spam' : $message = __('This comment is currently marked as spam.'); break; case 'trash' : $message = __('This comment is currently in the Trash.'); break; } if ( $message ) echo '<div class="updated"><p>' . $message . '</p></div>'; } ?> <p><strong><?php _e('Caution:'); ?></strong> <?php echo $caution_msg; ?></p> <table class="form-table comment-ays"> <tr class="alt"> <th scope="row"><?php _e('Author'); ?></th> <td><?php echo $comment->comment_author; ?></td> </tr> <?php if ( $comment->comment_author_email ) { ?> <tr> <th scope="row"><?php _e('E-mail'); ?></th> <td><?php echo $comment->comment_author_email; ?></td> </tr> <?php } ?> <?php if ( $comment->comment_author_url ) { ?> <tr> <th scope="row"><?php _e('URL'); ?></th> <td><a href="<?php echo $comment->comment_author_url; ?>"><?php echo $comment->comment_author_url; ?></a></td> </tr> <?php } ?> <tr> <th scope="row"><?php /* translators: field name in comment form */ _ex('Comment', 'noun'); ?></th> <td><?php echo $comment->comment_content; ?></td> </tr> </table> <p><?php _e('Are you sure you want to do this?'); ?></p> <form action='comment.php' method='get'> <table width="100%"> <tr> <td><a class="button" href="<?php echo admin_url('edit-comments.php'); ?>"><?php esc_attr_e('No'); ?></a></td> <td class="textright"><?php submit_button( $button, 'button' ); ?></td> </tr> </table> <?php wp_nonce_field( $nonce_action ); ?> <input type='hidden' name='action' value='<?php echo esc_attr($formaction); ?>' /> <input type='hidden' name='c' value='<?php echo esc_attr($comment->comment_ID); ?>' /> <input type='hidden' name='noredir' value='1' /> </form> </div> </div> <?php break; case 'deletecomment' : case 'trashcomment' : case 'untrashcomment' : case 'spamcomment' : case 'unspamcomment' : case 'approvecomment' : case 'unapprovecomment' : $comment_id = absint( $_REQUEST['c'] ); if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) check_admin_referer( 'approve-comment_' . $comment_id ); else check_admin_referer( 'delete-comment_' . $comment_id ); $noredir = isset($_REQUEST['noredir']); if ( !$comment = get_comment($comment_id) ) comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'edit-comments.php') ); if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) comment_footer_die( __('You are not allowed to edit comments on this post.') ); if ( '' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php') ) $redir = wp_get_referer(); elseif ( '' != wp_get_original_referer() && ! $noredir ) $redir = wp_get_original_referer(); elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) $redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) ); else $redir = admin_url('edit-comments.php'); $redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved'), $redir ); switch ( $action ) { case 'deletecomment' : wp_delete_comment( $comment_id ); $redir = add_query_arg( array('deleted' => '1'), $redir ); break; case 'trashcomment' : wp_trash_comment($comment_id); $redir = add_query_arg( array('trashed' => '1', 'ids' => $comment_id), $redir ); break; case 'untrashcomment' : wp_untrash_comment($comment_id); $redir = add_query_arg( array('untrashed' => '1'), $redir ); break; case 'spamcomment' : wp_spam_comment($comment_id); $redir = add_query_arg( array('spammed' => '1', 'ids' => $comment_id), $redir ); break; case 'unspamcomment' : wp_unspam_comment($comment_id); $redir = add_query_arg( array('unspammed' => '1'), $redir ); break; case 'approvecomment' : wp_set_comment_status( $comment_id, 'approve' ); $redir = add_query_arg( array( 'approved' => 1 ), $redir ); break; case 'unapprovecomment' : wp_set_comment_status( $comment_id, 'hold' ); $redir = add_query_arg( array( 'unapproved' => 1 ), $redir ); break; } wp_redirect( $redir ); die; break; case 'editedcomment' : $comment_id = absint( $_POST['comment_ID'] ); $comment_post_id = absint( $_POST['comment_post_ID'] ); check_admin_referer( 'update-comment_' . $comment_id ); edit_comment(); $location = ( empty( $_POST['referredby'] ) ? "edit-comments.php?p=$comment_post_id" : $_POST['referredby'] ) . '#comment-' . $comment_id; /** * Filter the URI the user is redirected to after editing a comment in the admin. * * @since 2.1.0 * * @param string $location The URI the user will be redirected to. * @param int $comment_id The ID of the comment being edited. */ $location = apply_filters( 'comment_edit_redirect', $location, $comment_id ); wp_redirect( $location ); exit(); break; default: wp_die( __('Unknown action.') ); break; } // end switch include( ABSPATH . 'wp-admin/admin-footer.php' );
01-wordpress-paypal
trunk/wp-admin/comment.php
PHP
gpl3
9,178
<?php /** * Media Library administration panel. * * @package WordPress * @subpackage Administration */ /** WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); if ( !current_user_can('upload_files') ) wp_die( __( 'You do not have permission to upload files.' ) ); $wp_list_table = _get_list_table('WP_Media_List_Table'); $pagenum = $wp_list_table->get_pagenum(); // Handle bulk actions $doaction = $wp_list_table->current_action(); if ( $doaction ) { check_admin_referer('bulk-media'); if ( 'delete_all' == $doaction ) { $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" ); $doaction = 'delete'; } elseif ( isset( $_REQUEST['media'] ) ) { $post_ids = $_REQUEST['media']; } elseif ( isset( $_REQUEST['ids'] ) ) { $post_ids = explode( ',', $_REQUEST['ids'] ); } $location = 'upload.php'; if ( $referer = wp_get_referer() ) { if ( false !== strpos( $referer, 'upload.php' ) ) $location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer ); } switch ( $doaction ) { case 'find_detached': if ( !current_user_can('edit_posts') ) wp_die( __('You are not allowed to scan for lost attachments.') ); $lost = $wpdb->get_col( " SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent > '0' AND post_parent NOT IN ( SELECT ID FROM $wpdb->posts WHERE post_type NOT IN ( 'attachment', '" . join( "', '", get_post_types( array( 'public' => false ) ) ) . "' ) ) " ); $_REQUEST['detached'] = 1; break; case 'attach': $parent_id = (int) $_REQUEST['found_post_id']; if ( !$parent_id ) return; $parent = get_post( $parent_id ); if ( !current_user_can( 'edit_post', $parent_id ) ) wp_die( __( 'You are not allowed to edit this post.' ) ); $attach = array(); foreach ( (array) $_REQUEST['media'] as $att_id ) { $att_id = (int) $att_id; if ( !current_user_can( 'edit_post', $att_id ) ) continue; $attach[] = $att_id; } if ( ! empty( $attach ) ) { $attach_string = implode( ',', $attach ); $attached = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $attach_string )", $parent_id ) ); foreach ( $attach as $att_id ) { clean_attachment_cache( $att_id ); } } if ( isset( $attached ) ) { $location = 'upload.php'; if ( $referer = wp_get_referer() ) { if ( false !== strpos( $referer, 'upload.php' ) ) $location = $referer; } $location = add_query_arg( array( 'attached' => $attached ) , $location ); wp_redirect( $location ); exit; } break; case 'trash': if ( !isset( $post_ids ) ) break; foreach ( (array) $post_ids as $post_id ) { if ( !current_user_can( 'delete_post', $post_id ) ) wp_die( __( 'You are not allowed to move this post to the trash.' ) ); if ( !wp_trash_post( $post_id ) ) wp_die( __( 'Error in moving to trash.' ) ); } $location = add_query_arg( array( 'trashed' => count( $post_ids ), 'ids' => join( ',', $post_ids ) ), $location ); break; case 'untrash': if ( !isset( $post_ids ) ) break; foreach ( (array) $post_ids as $post_id ) { if ( !current_user_can( 'delete_post', $post_id ) ) wp_die( __( 'You are not allowed to move this post out of the trash.' ) ); if ( !wp_untrash_post( $post_id ) ) wp_die( __( 'Error in restoring from trash.' ) ); } $location = add_query_arg( 'untrashed', count( $post_ids ), $location ); break; case 'delete': if ( !isset( $post_ids ) ) break; foreach ( (array) $post_ids as $post_id_del ) { if ( !current_user_can( 'delete_post', $post_id_del ) ) wp_die( __( 'You are not allowed to delete this post.' ) ); if ( !wp_delete_attachment( $post_id_del ) ) wp_die( __( 'Error in deleting.' ) ); } $location = add_query_arg( 'deleted', count( $post_ids ), $location ); break; } wp_redirect( $location ); exit; } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); exit; } $wp_list_table->prepare_items(); $title = __('Media Library'); $parent_file = 'upload.php'; wp_enqueue_script( 'media' ); add_screen_option( 'per_page', array('label' => _x( 'Media items', 'items per page (screen options)' )) ); get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __( 'All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the Screen Options tab to customize the display of this screen.' ) . '</p>' . '<p>' . __( 'You can narrow the list by file type/status using the text link filters at the top of the screen. You also can refine the list by date using the dropdown menu above the media table.' ) . '</p>' ) ); get_current_screen()->add_help_tab( array( 'id' => 'actions-links', 'title' => __('Available Actions'), 'content' => '<p>' . __( 'Hovering over a row reveals action links: Edit, Delete Permanently, and View. Clicking Edit or on the media file&#8217;s name displays a simple screen to edit that individual file&#8217;s metadata. Clicking Delete Permanently will delete the file from the media library (as well as from any posts to which it is currently attached). View will take you to the display page for that file.' ) . '</p>' ) ); get_current_screen()->add_help_tab( array( 'id' => 'attaching-files', 'title' => __('Attaching Files'), 'content' => '<p>' . __( 'If a media file has not been attached to any post, you will see that in the Attached To column, and can click on Attach File to launch a small popup that will allow you to search for a post and attach the file.' ) . '</p>' ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . '<p>' . __( '<a href="http://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>' ) . '</p>' . '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' ); require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?> <div class="wrap"> <h2> <?php echo esc_html( $title ); if ( current_user_can( 'upload_files' ) ) { ?> <a href="media-new.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'file'); ?></a><?php } if ( ! empty( $_REQUEST['s'] ) ) printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() ); ?> </h2> <?php $message = ''; if ( ! empty( $_GET['posted'] ) ) { $message = __('Media attachment updated.'); $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']); } if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) { $message = sprintf( _n('Reattached %d attachment.', 'Reattached %d attachments.', $attached), $attached ); $_SERVER['REQUEST_URI'] = remove_query_arg(array('attached'), $_SERVER['REQUEST_URI']); } if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) { $message = sprintf( _n( 'Media attachment permanently deleted.', '%d media attachments permanently deleted.', $deleted ), number_format_i18n( $_GET['deleted'] ) ); $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']); } if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) { $message = sprintf( _n( 'Media attachment moved to the trash.', '%d media attachments moved to the trash.', $trashed ), number_format_i18n( $_GET['trashed'] ) ); $message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>'; $_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']); } if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) { $message = sprintf( _n( 'Media attachment restored from the trash.', '%d media attachments restored from the trash.', $untrashed ), number_format_i18n( $_GET['untrashed'] ) ); $_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']); } $messages[1] = __('Media attachment updated.'); $messages[2] = __('Media permanently deleted.'); $messages[3] = __('Error saving media attachment.'); $messages[4] = __('Media moved to the trash.') . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>'; $messages[5] = __('Media restored from the trash.'); if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) { $message = $messages[ $_GET['message'] ]; $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']); } if ( !empty($message) ) { ?> <div id="message" class="updated"><p><?php echo $message; ?></p></div> <?php } ?> <?php $wp_list_table->views(); ?> <form id="posts-filter" action="" method="get"> <?php $wp_list_table->search_box( __( 'Search Media' ), 'media' ); ?> <?php $wp_list_table->display(); ?> <div id="ajax-response"></div> <?php find_posts_div(); ?> </form> </div> <?php include( ABSPATH . 'wp-admin/admin-footer.php' );
01-wordpress-paypal
trunk/wp-admin/upload.php
PHP
gpl3
9,472
<?php /** * Edit Comments Administration Screen. * * @package WordPress * @subpackage Administration */ /** WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); if ( !current_user_can('edit_posts') ) wp_die(__('Cheatin&#8217; uh?')); $wp_list_table = _get_list_table('WP_Comments_List_Table'); $pagenum = $wp_list_table->get_pagenum(); $doaction = $wp_list_table->current_action(); if ( $doaction ) { check_admin_referer( 'bulk-comments' ); if ( 'delete_all' == $doaction && !empty( $_REQUEST['pagegen_timestamp'] ) ) { $comment_status = wp_unslash( $_REQUEST['comment_status'] ); $delete_time = wp_unslash( $_REQUEST['pagegen_timestamp'] ); $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s AND %s > comment_date_gmt", $comment_status, $delete_time ) ); $doaction = 'delete'; } elseif ( isset( $_REQUEST['delete_comments'] ) ) { $comment_ids = $_REQUEST['delete_comments']; $doaction = ( $_REQUEST['action'] != -1 ) ? $_REQUEST['action'] : $_REQUEST['action2']; } elseif ( isset( $_REQUEST['ids'] ) ) { $comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) ); } elseif ( wp_get_referer() ) { wp_safe_redirect( wp_get_referer() ); exit; } $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0; $redirect_to = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids' ), wp_get_referer() ); $redirect_to = add_query_arg( 'paged', $pagenum, $redirect_to ); foreach ( $comment_ids as $comment_id ) { // Check the permissions on each if ( !current_user_can( 'edit_comment', $comment_id ) ) continue; switch ( $doaction ) { case 'approve' : wp_set_comment_status( $comment_id, 'approve' ); $approved++; break; case 'unapprove' : wp_set_comment_status( $comment_id, 'hold' ); $unapproved++; break; case 'spam' : wp_spam_comment( $comment_id ); $spammed++; break; case 'unspam' : wp_unspam_comment( $comment_id ); $unspammed++; break; case 'trash' : wp_trash_comment( $comment_id ); $trashed++; break; case 'untrash' : wp_untrash_comment( $comment_id ); $untrashed++; break; case 'delete' : wp_delete_comment( $comment_id ); $deleted++; break; } } if ( $approved ) $redirect_to = add_query_arg( 'approved', $approved, $redirect_to ); if ( $unapproved ) $redirect_to = add_query_arg( 'unapproved', $unapproved, $redirect_to ); if ( $spammed ) $redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to ); if ( $unspammed ) $redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to ); if ( $trashed ) $redirect_to = add_query_arg( 'trashed', $trashed, $redirect_to ); if ( $untrashed ) $redirect_to = add_query_arg( 'untrashed', $untrashed, $redirect_to ); if ( $deleted ) $redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to ); if ( $trashed || $spammed ) $redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to ); wp_safe_redirect( $redirect_to ); exit; } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); exit; } $wp_list_table->prepare_items(); wp_enqueue_script('admin-comments'); enqueue_comment_hotkeys_js(); if ( $post_id ) $title = sprintf( __( 'Comments on &#8220;%s&#8221;' ), wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '&hellip;' ) ); else $title = __('Comments'); add_screen_option( 'per_page', array('label' => _x( 'Comments', 'comments per page (screen options)' )) ); get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __( 'You can manage comments made on your site similar to the way you manage posts and other content. This screen is customizable in the same ways as other management screens, and you can act on comments using the on-hover action links or the Bulk Actions.' ) . '</p>' ) ); get_current_screen()->add_help_tab( array( 'id' => 'moderating-comments', 'title' => __('Moderating Comments'), 'content' => '<p>' . __( 'A red bar on the left means the comment is waiting for you to moderate it.' ) . '</p>' . '<p>' . __( 'In the <strong>Author</strong> column, in addition to the author&#8217;s name, email address, and blog URL, the commenter&#8217;s IP address is shown. Clicking on this link will show you all the comments made from this IP address.' ) . '</p>' . '<p>' . __( 'In the <strong>Comment</strong> column, above each comment it says &#8220;Submitted on,&#8221; followed by the date and time the comment was left on your site. Clicking on the date/time link will take you to that comment on your live site. Hovering over any comment gives you options to approve, reply (and approve), quick edit, edit, spam mark, or trash that comment.' ) . '</p>' . '<p>' . __( 'In the <strong>In Response To</strong> column, there are three elements. The text is the name of the post that inspired the comment, and links to the post editor for that entry. The View Post link leads to that post on your live site. The small bubble with the number in it shows the number of approved comments that post has received. If the bubble is gray, you have moderated all comments for that post. If it is blue, there are pending comments. Clicking the bubble will filter the comments screen to show only comments on that post.' ) . '</p>' . '<p>' . __( 'Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link to the side to learn more.' ) . '</p>' ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . '<p>' . __( '<a href="http://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>' ) . '</p>' . '<p>' . __( '<a href="http://codex.wordpress.org/Comment_Spam" target="_blank">Documentation on Comment Spam</a>' ) . '</p>' . '<p>' . __( '<a href="http://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">Documentation on Keyboard Shortcuts</a>' ) . '</p>' . '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' ); require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?> <div class="wrap"> <h2><?php if ( $post_id ) echo sprintf( __( 'Comments on &#8220;%s&#8221;' ), sprintf( '<a href="%s">%s</a>', get_edit_post_link( $post_id ), wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '&hellip;' ) ) ); else echo __('Comments'); if ( isset($_REQUEST['s']) && $_REQUEST['s'] ) echo '<span class="subtitle">' . sprintf( __( 'Search results for &#8220;%s&#8221;' ), wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '&hellip;' ) ) . '</span>'; ?> </h2> <?php if ( isset( $_REQUEST['error'] ) ) { $error = (int) $_REQUEST['error']; $error_msg = ''; switch ( $error ) { case 1 : $error_msg = __( 'Oops, no comment with this ID.' ); break; case 2 : $error_msg = __( 'You are not allowed to edit comments on this post.' ); break; } if ( $error_msg ) echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>'; } if ( isset($_REQUEST['approved']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) || isset($_REQUEST['spammed']) || isset($_REQUEST['unspammed']) || isset($_REQUEST['same']) ) { $approved = isset( $_REQUEST['approved'] ) ? (int) $_REQUEST['approved'] : 0; $deleted = isset( $_REQUEST['deleted'] ) ? (int) $_REQUEST['deleted'] : 0; $trashed = isset( $_REQUEST['trashed'] ) ? (int) $_REQUEST['trashed'] : 0; $untrashed = isset( $_REQUEST['untrashed'] ) ? (int) $_REQUEST['untrashed'] : 0; $spammed = isset( $_REQUEST['spammed'] ) ? (int) $_REQUEST['spammed'] : 0; $unspammed = isset( $_REQUEST['unspammed'] ) ? (int) $_REQUEST['unspammed'] : 0; $same = isset( $_REQUEST['same'] ) ? (int) $_REQUEST['same'] : 0; if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) { if ( $approved > 0 ) $messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved ); if ( $spammed > 0 ) { $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; $messages[] = sprintf( _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ), $spammed ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=unspam&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />'; } if ( $unspammed > 0 ) $messages[] = sprintf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed ); if ( $trashed > 0 ) { $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; $messages[] = sprintf( _n( '%s comment moved to the Trash.', '%s comments moved to the Trash.', $trashed ), $trashed ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=untrash&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />'; } if ( $untrashed > 0 ) $messages[] = sprintf( _n( '%s comment restored from the Trash', '%s comments restored from the Trash', $untrashed ), $untrashed ); if ( $deleted > 0 ) $messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted ); if ( $same > 0 && $comment = get_comment( $same ) ) { switch ( $comment->comment_approved ) { case '1' : $messages[] = __('This comment is already approved.') . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>'; break; case 'trash' : $messages[] = __( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __( 'View Trash' ) . '</a>'; break; case 'spam' : $messages[] = __( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>'; break; } } echo '<div id="moderated" class="updated"><p>' . implode( "<br/>\n", $messages ) . '</p></div>'; } } ?> <?php $wp_list_table->views(); ?> <form id="comments-form" action="" method="get"> <?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?> <?php if ( $post_id ) : ?> <input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" /> <?php endif; ?> <input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?>" /> <input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr(current_time('mysql', 1)); ?>" /> <input type="hidden" name="_total" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('total_items') ); ?>" /> <input type="hidden" name="_per_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('per_page') ); ?>" /> <input type="hidden" name="_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('page') ); ?>" /> <?php if ( isset($_REQUEST['paged']) ) { ?> <input type="hidden" name="paged" value="<?php echo esc_attr( absint( $_REQUEST['paged'] ) ); ?>" /> <?php } ?> <?php $wp_list_table->display(); ?> </form> </div> <div id="ajax-response"></div> <?php wp_comment_reply('-1', true, 'detail'); wp_comment_trashnotice(); include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
01-wordpress-paypal
trunk/wp-admin/edit-comments.php
PHP
gpl3
11,661
<?php /** * Retrieves and creates the wp-config.php file. * * The permissions for the base directory must allow for writing files in order * for the wp-config.php to be created using this page. * * @internal This file must be parsable by PHP4. * * @package WordPress * @subpackage Administration */ /** * We are installing. */ define('WP_INSTALLING', true); /** * We are blissfully unaware of anything. */ define('WP_SETUP_CONFIG', true); /** * Disable error reporting * * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging */ error_reporting(0); /**#@+ * These three defines are required to allow us to use require_wp_db() to load * the database class while being wp-content/db.php aware. * @ignore */ define('ABSPATH', dirname(dirname(__FILE__)).'/'); define('WPINC', 'wp-includes'); define('WP_CONTENT_DIR', ABSPATH . 'wp-content'); define('WP_DEBUG', false); /**#@-*/ require(ABSPATH . WPINC . '/load.php'); require(ABSPATH . WPINC . '/version.php'); // Check for the required PHP version and for the MySQL extension or a database drop-in. wp_check_php_mysql_versions(); require_once(ABSPATH . WPINC . '/functions.php'); // Also loads plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php) wp_load_translations_early(); // Turn register_globals off. wp_unregister_GLOBALS(); // Standardize $_SERVER variables across setups. wp_fix_server_vars(); require_once(ABSPATH . WPINC . '/compat.php'); require_once(ABSPATH . WPINC . '/class-wp-error.php'); require_once(ABSPATH . WPINC . '/formatting.php'); // Add magic quotes and set up $_REQUEST ( $_GET + $_POST ) wp_magic_quotes(); // Support wp-config-sample.php one level up, for the develop repo. if ( file_exists( ABSPATH . 'wp-config-sample.php' ) ) $config_file = file( ABSPATH . 'wp-config-sample.php' ); elseif ( file_exists( dirname( ABSPATH ) . '/wp-config-sample.php' ) ) $config_file = file( dirname( ABSPATH ) . '/wp-config-sample.php' ); else wp_die( __( 'Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.' ) ); // Check if wp-config.php has been created if ( file_exists( ABSPATH . 'wp-config.php' ) ) wp_die( '<p>' . sprintf( __( "The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='%s'>installing now</a>." ), 'install.php' ) . '</p>' ); // Check if wp-config.php exists above the root directory but is not part of another install if ( file_exists(ABSPATH . '../wp-config.php' ) && ! file_exists( ABSPATH . '../wp-settings.php' ) ) wp_die( '<p>' . sprintf( __( "The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>."), 'install.php' ) . '</p>' ); $step = isset( $_GET['step'] ) ? (int) $_GET['step'] : 0; /** * Display setup wp-config.php file header. * * @ignore * @since 2.3.0 */ function setup_config_display_header() { global $wp_version; header( 'Content-Type: text/html; charset=utf-8' ); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>> <head> <meta name="viewport" content="width=device-width" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php _e( 'WordPress &rsaquo; Setup Configuration File' ); ?></title> <link rel="stylesheet" href="css/install.css?ver=<?php echo preg_replace( '/[^0-9a-z\.-]/i', '', $wp_version ); ?>" type="text/css" /> <link rel="stylesheet" href="../wp-includes/css/buttons.css?ver=<?php echo preg_replace( '/[^0-9a-z\.-]/i', '', $wp_version ); ?>" type="text/css" /> </head> <body class="wp-core-ui<?php if ( is_rtl() ) echo ' rtl'; ?>"> <h1 id="logo"><a href="<?php esc_attr_e( 'https://wordpress.org/' ); ?>"><?php _e( 'WordPress' ); ?></a></h1> <?php } // end function setup_config_display_header(); switch($step) { case 0: setup_config_display_header(); ?> <p><?php _e( 'Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.' ) ?></p> <ol> <li><?php _e( 'Database name' ); ?></li> <li><?php _e( 'Database username' ); ?></li> <li><?php _e( 'Database password' ); ?></li> <li><?php _e( 'Database host' ); ?></li> <li><?php _e( 'Table prefix (if you want to run more than one WordPress in a single database)' ); ?></li> </ol> <p><strong><?php _e( "If for any reason this automatic file creation doesn&#8217;t work, don&#8217;t worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>." ); ?></strong></p> <p><?php _e( "In all likelihood, these items were supplied to you by your Web Host. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;" ); ?></p> <p class="step"><a href="setup-config.php?step=1<?php if ( isset( $_GET['noapi'] ) ) echo '&amp;noapi'; ?>" class="button button-large"><?php _e( 'Let&#8217;s go!' ); ?></a></p> <?php break; case 1: setup_config_display_header(); ?> <form method="post" action="setup-config.php?step=2"> <p><?php _e( "Below you should enter your database connection details. If you&#8217;re not sure about these, contact your host." ); ?></p> <table class="form-table"> <tr> <th scope="row"><label for="dbname"><?php _e( 'Database Name' ); ?></label></th> <td><input name="dbname" id="dbname" type="text" size="25" value="wordpress" /></td> <td><?php _e( 'The name of the database you want to run WP in.' ); ?></td> </tr> <tr> <th scope="row"><label for="uname"><?php _e( 'User Name' ); ?></label></th> <td><input name="uname" id="uname" type="text" size="25" value="<?php echo htmlspecialchars( _x( 'username', 'example username' ), ENT_QUOTES ); ?>" /></td> <td><?php _e( 'Your MySQL username' ); ?></td> </tr> <tr> <th scope="row"><label for="pwd"><?php _e( 'Password' ); ?></label></th> <td><input name="pwd" id="pwd" type="text" size="25" value="<?php echo htmlspecialchars( _x( 'password', 'example password' ), ENT_QUOTES ); ?>" /></td> <td><?php _e( '&hellip;and your MySQL password.' ); ?></td> </tr> <tr> <th scope="row"><label for="dbhost"><?php _e( 'Database Host' ); ?></label></th> <td><input name="dbhost" id="dbhost" type="text" size="25" value="localhost" /></td> <td><?php _e( 'You should be able to get this info from your web host, if <code>localhost</code> does not work.' ); ?></td> </tr> <tr> <th scope="row"><label for="prefix"><?php _e( 'Table Prefix' ); ?></label></th> <td><input name="prefix" id="prefix" type="text" value="wp_" size="25" /></td> <td><?php _e( 'If you want to run multiple WordPress installations in a single database, change this.' ); ?></td> </tr> </table> <?php if ( isset( $_GET['noapi'] ) ) { ?><input name="noapi" type="hidden" value="1" /><?php } ?> <p class="step"><input name="submit" type="submit" value="<?php echo htmlspecialchars( __( 'Submit' ), ENT_QUOTES ); ?>" class="button button-large" /></p> </form> <?php break; case 2: foreach ( array( 'dbname', 'uname', 'pwd', 'dbhost', 'prefix' ) as $key ) $$key = trim( wp_unslash( $_POST[ $key ] ) ); $tryagain_link = '</p><p class="step"><a href="setup-config.php?step=1" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try again' ) . '</a>'; if ( empty( $prefix ) ) wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) ); // Validate $prefix: it can only contain letters, numbers and underscores. if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) wp_die( __( '<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' . $tryagain_link ) ); // Test the db connection. /**#@+ * @ignore */ define('DB_NAME', $dbname); define('DB_USER', $uname); define('DB_PASSWORD', $pwd); define('DB_HOST', $dbhost); /**#@-*/ // We'll fail here if the values are no good. require_wp_db(); if ( ! empty( $wpdb->error ) ) wp_die( $wpdb->error->get_error_message() . $tryagain_link ); // Fetch or generate keys and salts. $no_api = isset( $_POST['noapi'] ); if ( ! $no_api ) { require_once( ABSPATH . WPINC . '/class-http.php' ); require_once( ABSPATH . WPINC . '/http.php' ); /**#@+ * @ignore */ function get_bloginfo() { return wp_guess_url(); } /**#@-*/ $secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); } if ( $no_api || is_wp_error( $secret_keys ) ) { $secret_keys = array(); require_once( ABSPATH . WPINC . '/pluggable.php' ); for ( $i = 0; $i < 8; $i++ ) { $secret_keys[] = wp_generate_password( 64, true, true ); } } else { $secret_keys = explode( "\n", wp_remote_retrieve_body( $secret_keys ) ); foreach ( $secret_keys as $k => $v ) { $secret_keys[$k] = substr( $v, 28, 64 ); } } $key = 0; // Not a PHP5-style by-reference foreach, as this file must be parseable by PHP4. foreach ( $config_file as $line_num => $line ) { if ( '$table_prefix =' == substr( $line, 0, 16 ) ) { $config_file[ $line_num ] = '$table_prefix = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n"; continue; } if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) ) continue; $constant = $match[1]; $padding = $match[2]; switch ( $constant ) { case 'DB_NAME' : case 'DB_USER' : case 'DB_PASSWORD' : case 'DB_HOST' : $config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n"; break; case 'AUTH_KEY' : case 'SECURE_AUTH_KEY' : case 'LOGGED_IN_KEY' : case 'NONCE_KEY' : case 'AUTH_SALT' : case 'SECURE_AUTH_SALT' : case 'LOGGED_IN_SALT' : case 'NONCE_SALT' : $config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n"; break; } } unset( $line ); if ( ! is_writable(ABSPATH) ) : setup_config_display_header(); ?> <p><?php _e( "Sorry, but I can&#8217;t write the <code>wp-config.php</code> file." ); ?></p> <p><?php _e( 'You can create the <code>wp-config.php</code> manually and paste the following text into it.' ); ?></p> <textarea id="wp-config" cols="98" rows="15" class="code" readonly="readonly"><?php foreach( $config_file as $line ) { echo htmlentities($line, ENT_COMPAT, 'UTF-8'); } ?></textarea> <p><?php _e( 'After you&#8217;ve done that, click &#8220;Run the install.&#8221;' ); ?></p> <p class="step"><a href="install.php" class="button button-large"><?php _e( 'Run the install' ); ?></a></p> <script> (function(){ var el=document.getElementById('wp-config'); el.focus(); el.select(); })(); </script> <?php else : // If this file doesn't exist, then we are using the wp-config-sample.php // file one level up, which is for the develop repo. if ( file_exists( ABSPATH . 'wp-config-sample.php' ) ) $path_to_wp_config = ABSPATH . 'wp-config.php'; else $path_to_wp_config = dirname( ABSPATH ) . '/wp-config.php'; $handle = fopen( $path_to_wp_config, 'w' ); foreach( $config_file as $line ) { fwrite( $handle, $line ); } fclose( $handle ); chmod( $path_to_wp_config, 0666 ); setup_config_display_header(); ?> <p><?php _e( "All right, sparky! You&#8217;ve made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to&hellip;" ); ?></p> <p class="step"><a href="install.php" class="button button-large"><?php _e( 'Run the install' ); ?></a></p> <?php endif; break; } ?> </body> </html>
01-wordpress-paypal
trunk/wp-admin/setup-config.php
PHP
gpl3
11,975
<?php /** * Themes administration panel. * * @package WordPress * @subpackage Administration */ /** WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') ) wp_die( __( 'Cheatin&#8217; uh?' ) ); if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) { if ( 'activate' == $_GET['action'] ) { check_admin_referer('switch-theme_' . $_GET['stylesheet']); $theme = wp_get_theme( $_GET['stylesheet'] ); if ( ! $theme->exists() || ! $theme->is_allowed() ) wp_die( __( 'Cheatin&#8217; uh?' ) ); switch_theme( $theme->get_stylesheet() ); wp_redirect( admin_url('themes.php?activated=true') ); exit; } elseif ( 'delete' == $_GET['action'] ) { check_admin_referer('delete-theme_' . $_GET['stylesheet']); $theme = wp_get_theme( $_GET['stylesheet'] ); if ( !current_user_can('delete_themes') || ! $theme->exists() ) wp_die( __( 'Cheatin&#8217; uh?' ) ); delete_theme($_GET['stylesheet']); wp_redirect( admin_url('themes.php?deleted=true') ); exit; } } $title = __('Manage Themes'); $parent_file = 'themes.php'; // Help tab: Overview if ( current_user_can( 'switch_themes' ) ) { $help_overview = '<p>' . __( 'This screen is used for managing your installed themes. Aside from the default theme(s) included with your WordPress installation, themes are designed and developed by third parties.' ) . '</p>' . '<p>' . __( 'From this screen you can:' ) . '</p>' . '<ul><li>' . __( 'Hover or tap to see Activate and Live Preview buttons' ) . '</li>' . '<li>' . __( 'Click on the theme to see the theme name, version, author, description, tags, and the Delete link' ) . '</li>' . '<li>' . __( 'Click Customize for the current theme or Live Preview for any other theme to see a live preview' ) . '</li></ul>' . '<p>' . __( 'The current theme is displayed highlighted as the first theme.' ) . '</p>'; get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => $help_overview ) ); } // switch_themes // Help tab: Adding Themes if ( current_user_can( 'install_themes' ) ) { if ( is_multisite() ) { $help_install = '<p>' . __('Installing themes on Multisite can only be done from the Network Admin section.') . '</p>'; } else { $help_install = '<p>' . sprintf( __('If you would like to see more themes to choose from, click on the &#8220;Add New&#8221; button and you will be able to browse or search for additional themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. Themes in the WordPress.org Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they&#8217;re free!'), 'https://wordpress.org/themes/' ) . '</p>'; } get_current_screen()->add_help_tab( array( 'id' => 'adding-themes', 'title' => __('Adding Themes'), 'content' => $help_install ) ); } // install_themes // Help tab: Previewing and Customizing if ( current_user_can( 'edit_theme_options' ) ) { $help_customize = '<p>' . __( 'Tap or hover on any theme then click the Live Preview button to see a live preview of that theme and change theme options in a separate, full-screen view. You can also find a Live Preview button at the bottom of the theme details screen. Any installed theme can be previewed and customized in this way.' ) . '</p>'. '<p>' . __( 'The theme being previewed is fully interactive &mdash; navigate to different pages to see how the theme handles posts, archives, and other page templates. The settings may differ depending on what theme features the theme being previewed supports. To accept the new settings and activate the theme all in one step, click the Save &amp; Activate button above the menu.' ) . '</p>' . '<p>' . __( 'When previewing on smaller monitors, you can use the collapse icon at the bottom of the left-hand pane. This will hide the pane, giving you more room to preview your site in the new theme. To bring the pane back, click on the collapse icon again.' ) . '</p>'; get_current_screen()->add_help_tab( array( 'id' => 'customize-preview-themes', 'title' => __( 'Previewing and Customizing' ), 'content' => $help_customize ) ); } // edit_theme_options get_current_screen()->set_help_sidebar( '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . '<p>' . __( '<a href="http://codex.wordpress.org/Using_Themes" target="_blank">Documentation on Using Themes</a>' ) . '</p>' . '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' ); if ( current_user_can( 'switch_themes' ) ) { $themes = wp_prepare_themes_for_js(); } else { $themes = wp_prepare_themes_for_js( array( wp_get_theme() ) ); } wp_reset_vars( array( 'theme', 'search' ) ); wp_localize_script( 'theme', '_wpThemeSettings', array( 'themes' => $themes, 'settings' => array( 'canInstall' => ( ! is_multisite() && current_user_can( 'install_themes' ) ), 'installURI' => ( ! is_multisite() && current_user_can( 'install_themes' ) ) ? admin_url( 'theme-install.php' ) : null, 'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete." ), 'adminUrl' => parse_url( admin_url(), PHP_URL_PATH ), ), 'l10n' => array( 'addNew' => __( 'Add New Theme' ), 'search' => __( 'Search Installed Themes' ), 'searchPlaceholder' => __( 'Search installed themes...' ), // placeholder (no ellipsis) ), ) ); add_thickbox(); wp_enqueue_script( 'theme' ); wp_enqueue_script( 'customize-loader' ); require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?> <div class="wrap"> <h2><?php esc_html_e( 'Themes' ); ?> <span class="theme-count"><?php echo count( $themes ); ?></span> <?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?> <a href="<?php echo admin_url( 'theme-install.php' ); ?>" class="hide-if-no-js add-new-h2"><?php echo esc_html( _x( 'Add New', 'Add new theme' ) ); ?></a> <?php endif; ?> </h2> <?php if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) : ?> <div id="message1" class="updated"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div> <?php elseif ( isset($_GET['activated']) ) : if ( isset( $_GET['previewed'] ) ) { ?> <div id="message2" class="updated"><p><?php printf( __( 'Settings saved and theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div> <?php } else { ?> <div id="message2" class="updated"><p><?php printf( __( 'New theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div><?php } elseif ( isset($_GET['deleted']) ) : ?> <div id="message3" class="updated"><p><?php _e('Theme deleted.') ?></p></div> <?php endif; $ct = wp_get_theme(); if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) { echo '<div class="error"><p>' . sprintf( __( 'ERROR: %s' ), $ct->errors()->get_error_message() ) . '</p></div>'; } /* // Certain error codes are less fatal than others. We can still display theme information in most cases. if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() ) && in_array( $ct->errors()->get_error_code(), array( 'theme_no_parent', 'theme_parent_invalid', 'theme_no_index' ) ) ) ) : ?> */ // Pretend you didn't see this. $current_theme_actions = array(); if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) { foreach ( (array) $submenu['themes.php'] as $item) { $class = ''; if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 'customize.php' == $item[2] ) continue; // 0 = name, 1 = capability, 2 = file if ( ( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)) ) $class = ' class="current"'; if ( !empty($submenu[$item[2]]) ) { $submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index. $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]); if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook)) $current_theme_actions[] = "<a class='button button-secondary' href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>"; else $current_theme_actions[] = "<a class='button button-secondary' href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>"; } else if ( current_user_can($item[1]) ) { $menu_file = $item[2]; if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) $menu_file = substr( $menu_file, 0, $pos ); if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) { $current_theme_actions[] = "<a class='button button-secondary' href='{$item[2]}'$class>{$item[0]}</a>"; } else { $current_theme_actions[] = "<a class='button button-secondary' href='themes.php?page={$item[2]}'$class>{$item[0]}</a>"; } } } } ?> <div class="theme-browser"> <div class="themes"> <?php /* * This PHP is synchronized with the tmpl-theme template below! */ foreach ( $themes as $theme ) : $aria_action = esc_attr( $theme['id'] . '-action' ); $aria_name = esc_attr( $theme['id'] . '-name' ); ?> <div class="theme<?php if ( $theme['active'] ) echo ' active'; ?>" tabindex="0" aria-describedby="<?php echo $aria_action . ' ' . $aria_name; ?>"> <?php if ( ! empty( $theme['screenshot'][0] ) ) { ?> <div class="theme-screenshot"> <img src="<?php echo $theme['screenshot'][0]; ?>" alt="" /> </div> <?php } else { ?> <div class="theme-screenshot blank"></div> <?php } ?> <span class="more-details" id="<?php echo $aria_action; ?>"><?php _e( 'Theme Details' ); ?></span> <div class="theme-author"><?php printf( __( 'By %s' ), $theme['author'] ); ?></div> <?php if ( $theme['active'] ) { ?> <h3 class="theme-name" id="<?php echo $aria_name; ?>"><span><?php _ex( 'Active:', 'theme' ); ?></span> <?php echo $theme['name']; ?></h3> <?php } else { ?> <h3 class="theme-name" id="<?php echo $aria_name; ?>"><?php echo $theme['name']; ?></h3> <?php } ?> <div class="theme-actions"> <?php if ( $theme['active'] ) { ?> <?php if ( $theme['actions']['customize'] ) { ?> <a class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Customize' ); ?></a> <?php } ?> <?php } else { ?> <a class="button button-primary activate" href="<?php echo $theme['actions']['activate']; ?>"><?php _e( 'Activate' ); ?></a> <a class="button button-secondary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a> <a class="button button-secondary hide-if-customize" href="<?php echo $theme['actions']['preview']; ?>"><?php _e( 'Preview' ); ?></a> <?php } ?> </div> <?php if ( $theme['hasUpdate'] ) { ?> <div class="theme-update"><?php _e( 'Update Available' ); ?></div> <?php } ?> </div> <?php endforeach; ?> <br class="clear" /> </div> </div> <div class="theme-overlay"></div> <?php // List broken themes, if any. if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) { ?> <div class="broken-themes"> <h3><?php _e('Broken Themes'); ?></h3> <p><?php _e('The following themes are installed but incomplete. Themes must have a stylesheet and a template.'); ?></p> <table> <tr> <th><?php _ex('Name', 'theme name'); ?></th> <th><?php _e('Description'); ?></th> </tr> <?php foreach ( $broken_themes as $broken_theme ) { echo " <tr> <td>" . ( $broken_theme->get( 'Name' ) ? $broken_theme->get( 'Name' ) : $broken_theme->get_stylesheet() ) . "</td> <td>" . $broken_theme->errors()->get_error_message() . "</td> </tr>"; } ?> </table> </div> <?php } ?> </div><!-- .wrap --> <?php /* * The tmpl-theme template is synchronized with PHP above! */ ?> <script id="tmpl-theme" type="text/template"> <# if ( data.screenshot[0] ) { #> <div class="theme-screenshot"> <img src="{{ data.screenshot[0] }}" alt="" /> </div> <# } else { #> <div class="theme-screenshot blank"></div> <# } #> <span class="more-details" id="{{ data.id }}-action"><?php _e( 'Theme Details' ); ?></span> <div class="theme-author"><?php printf( __( 'By %s' ), '{{{ data.author }}}' ); ?></div> <# if ( data.active ) { #> <h3 class="theme-name" id="{{ data.id }}-name"><span><?php _ex( 'Active:', 'theme' ); ?></span> {{{ data.name }}}</h3> <# } else { #> <h3 class="theme-name" id="{{ data.id }}-name">{{{ data.name }}}</h3> <# } #> <div class="theme-actions"> <# if ( data.active ) { #> <# if ( data.actions.customize ) { #> <a class="button button-primary customize load-customize hide-if-no-customize" href="{{ data.actions.customize }}"><?php _e( 'Customize' ); ?></a> <# } #> <# } else { #> <a class="button button-primary activate" href="{{{ data.actions.activate }}}"><?php _e( 'Activate' ); ?></a> <a class="button button-secondary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a> <a class="button button-secondary hide-if-customize" href="{{{ data.actions.preview }}}"><?php _e( 'Preview' ); ?></a> <# } #> </div> <# if ( data.hasUpdate ) { #> <div class="theme-update"><?php _e( 'Update Available' ); ?></div> <# } #> </script> <script id="tmpl-theme-single" type="text/template"> <div class="theme-backdrop"></div> <div class="theme-wrap"> <div class="theme-header"> <button class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button> <button class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button> <button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close overlay' ); ?></span></button> </div> <div class="theme-about"> <div class="theme-screenshots"> <# if ( data.screenshot[0] ) { #> <div class="screenshot"><img src="{{ data.screenshot[0] }}" alt="" /></div> <# } else { #> <div class="screenshot blank"></div> <# } #> </div> <div class="theme-info"> <# if ( data.active ) { #> <span class="current-label"><?php _e( 'Current Theme' ); ?></span> <# } #> <h3 class="theme-name">{{{ data.name }}}<span class="theme-version"><?php printf( __( 'Version: %s' ), '{{{ data.version }}}' ); ?></span></h3> <h4 class="theme-author"><?php printf( __( 'By %s' ), '{{{ data.authorAndUri }}}' ); ?></h4> <# if ( data.hasUpdate ) { #> <div class="theme-update-message"> <h4 class="theme-update"><?php _e( 'Update Available' ); ?></h4> {{{ data.update }}} </div> <# } #> <p class="theme-description">{{{ data.description }}}</p> <# if ( data.parent ) { #> <p class="parent-theme"><?php printf( __( 'This is a child theme of %s.' ), '<strong>{{{ data.parent }}}</strong>' ); ?></p> <# } #> <# if ( data.tags ) { #> <p class="theme-tags"><span><?php _e( 'Tags:' ); ?></span> {{{ data.tags }}}</p> <# } #> </div> </div> <div class="theme-actions"> <div class="active-theme"> <a href="{{{ data.actions.customize }}}" class="button button-primary customize load-customize hide-if-no-customize"><?php _e( 'Customize' ); ?></a> <?php echo implode( ' ', $current_theme_actions ); ?> </div> <div class="inactive-theme"> <# if ( data.actions.activate ) { #> <a href="{{{ data.actions.activate }}}" class="button button-primary activate"><?php _e( 'Activate' ); ?></a> <# } #> <a href="{{{ data.actions.customize }}}" class="button button-secondary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a> <a href="{{{ data.actions.preview }}}" class="button button-secondary hide-if-customize"><?php _e( 'Preview' ); ?></a> </div> <# if ( ! data.active && data.actions['delete'] ) { #> <a href="{{{ data.actions['delete'] }}}" class="button button-secondary delete-theme"><?php _e( 'Delete' ); ?></a> <# } #> </div> </div> </script> <?php require( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
01-wordpress-paypal
trunk/wp-admin/themes.php
PHP
gpl3
16,224
<?php /** * Install plugin administration panel. * * @package WordPress * @subpackage Administration */ // TODO route this pages via a specific iframe handler instead of the do_action below if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) ) define( 'IFRAME_REQUEST', true ); /** * WordPress Administration Bootstrap. */ require_once( dirname( __FILE__ ) . '/admin.php' ); if ( ! current_user_can('install_plugins') ) wp_die(__('You do not have sufficient permissions to install plugins on this site.')); if ( is_multisite() && ! is_network_admin() ) { wp_redirect( network_admin_url( 'plugin-install.php' ) ); exit(); } $wp_list_table = _get_list_table('WP_Plugin_Install_List_Table'); $pagenum = $wp_list_table->get_pagenum(); $wp_list_table->prepare_items(); $title = __('Install Plugins'); $parent_file = 'plugins.php'; wp_enqueue_script( 'plugin-install' ); if ( 'plugin-information' != $tab ) add_thickbox(); $body_id = $tab; /** * Fires before each tab on the Install Plugins screen is loaded. * * The dynamic portion of the action hook, $tab, allows for targeting * individual tabs, for instance 'install_plugins_pre_plugin-information'. * * @since 2.7.0 */ do_action( "install_plugins_pre_$tab" ); get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . sprintf(__('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from the core WordPress application by thousands of developers all over the world. All plugins in the official <a href="%s" target="_blank">WordPress.org Plugin Directory</a> are compatible with the license WordPress uses. You can find new plugins to install by searching or browsing the Directory right here in your own Plugins section.'), 'https://wordpress.org/plugins/') . '</p>' ) ); get_current_screen()->add_help_tab( array( 'id' => 'adding-plugins', 'title' => __('Adding Plugins'), 'content' => '<p>' . __('If you know what you&#8217;re looking for, Search is your best bet. The Search screen has options to search the WordPress.org Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting popular tags. Tags in larger type mean more plugins have been labeled with that tag.') . '</p>' . '<p>' . __('If you just want to get an idea of what&#8217;s available, you can browse Featured, Popular, and Newest plugins by using the links in the upper left of the screen. These sections rotate regularly.') . '</p>' . '<p>' . __('You can also browse a user&#8217;s favorite plugins, by using the Favorites link in the upper left of the screen and entering their WordPress.org username.') . '</p>' . '<p>' . __('If you want to install a plugin that you&#8217;ve downloaded elsewhere, click the Upload link in the upper left. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.') . '</p>' ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Plugins_Add_New_Screen" target="_blank">Documentation on Installing Plugins</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); /** * WordPress Administration Template Header. */ include(ABSPATH . 'wp-admin/admin-header.php'); ?> <div class="wrap"> <h2><?php echo esc_html( $title ); ?></h2> <?php $wp_list_table->views(); ?> <br class="clear" /> <?php /** * Fires after the plugins list table in each tab of the Install Plugins screen. * * The dynamic portion of the action hook, $tab, allows for targeting * individual tabs, for instance 'install_plugins_plugin-information'. * * @since 2.7.0 * * @param int $paged The current page number of the plugins list table. */ ?> <?php do_action( "install_plugins_$tab", $paged ); ?> </div> <?php /** * WordPress Administration Template Footer. */ include(ABSPATH . 'wp-admin/admin-footer.php');
01-wordpress-paypal
trunk/wp-admin/plugin-install.php
PHP
gpl3
4,101
<?php /** * Multisite delete site panel. * * @package WordPress * @subpackage Multisite * @since 3.0.0 */ require_once( dirname( __FILE__ ) . '/admin.php' ); if ( !is_multisite() ) wp_die( __( 'Multisite support is not enabled.' ) ); // @todo Create a delete blog cap. if ( ! current_user_can( 'manage_options' ) ) wp_die(__( 'You do not have sufficient permissions to delete this site.')); if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) { if ( get_option( 'delete_blog_hash' ) == $_GET['h'] ) { wpmu_delete_blog( $wpdb->blogid ); wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), $current_site->site_name ) ); } else { wp_die( __( "I'm sorry, the link you clicked is stale. Please select another option." ) ); } } $blog = get_blog_details(); $title = __( 'Delete Site' ); $parent_file = 'tools.php'; require_once( ABSPATH . 'wp-admin/admin-header.php' ); echo '<div class="wrap">'; echo '<h2>' . esc_html( $title ) . '</h2>'; if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == '1' ) { check_admin_referer( 'delete-blog' ); $hash = wp_generate_password( 20, false ); update_option( 'delete_blog_hash', $hash ); $url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) ); $content = __( "Dear User, You recently clicked the 'Delete Site' link on your site and filled in a form on that page. If you really want to delete your site, click the link below. You will not be asked to confirm again so only click this link if you are absolutely certain: ###URL_DELETE### If you delete your site, please consider opening a new site here some time in the future! (But remember your current site and username are gone forever.) Thanks for using the site, Webmaster ###SITE_NAME###" ); /** * Filter the email content sent when a site in a Multisite network is deleted. * * @since 3.0.0 * * @param string $content The email content that will be sent to the user who deleted a site in a Multisite network. */ $content = apply_filters( 'delete_site_email_content', $content ); $content = str_replace( '###URL_DELETE###', $url_delete, $content ); $content = str_replace( '###SITE_NAME###', $current_site->site_name, $content ); wp_mail( get_option( 'admin_email' ), "[ " . wp_specialchars_decode( get_option( 'blogname' ) ) . " ] ".__( 'Delete My Site' ), $content ); ?> <p><?php _e( 'Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked. ') ?></p> <?php } else { ?> <p><?php printf( __( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'), $current_site->site_name); ?></p> <p><?php _e( 'Remember, once deleted your site cannot be restored.' ) ?></p> <form method="post" name="deletedirect"> <?php wp_nonce_field( 'delete-blog' ) ?> <input type="hidden" name="action" value="deleteblog" /> <p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf( __( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ), is_subdomain_install() ? $blog->domain : $blog->domain . $blog->path ); ?></strong></label></p> <?php submit_button( __( 'Delete My Site Permanently' ) ); ?> </form> <?php } echo '</div>'; include( ABSPATH . 'wp-admin/admin-footer.php' );
01-wordpress-paypal
trunk/wp-admin/ms-delete-site.php
PHP
gpl3
3,695
<?php /** * Disable error reporting * * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging */ error_reporting(0); /** Set ABSPATH for execution */ define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' ); define( 'WPINC', 'wp-includes' ); /** * @ignore */ function __() {} /** * @ignore */ function _x() {} /** * @ignore */ function add_filter() {} /** * @ignore */ function esc_attr() {} /** * @ignore */ function apply_filters() {} /** * @ignore */ function get_option() {} /** * @ignore */ function is_lighttpd_before_150() {} /** * @ignore */ function add_action() {} /** * @ignore */ function do_action_ref_array() {} /** * @ignore */ function get_bloginfo() {} /** * @ignore */ function is_admin() {return true;} /** * @ignore */ function site_url() {} /** * @ignore */ function admin_url() {} /** * @ignore */ function wp_guess_url() {} function get_file($path) { if ( function_exists('realpath') ) $path = realpath($path); if ( ! $path || ! @is_file($path) ) return ''; return @file_get_contents($path); } require(ABSPATH . '/wp-includes/script-loader.php'); require(ABSPATH . '/wp-includes/version.php'); $load = preg_replace( '/[^a-z0-9,_-]+/i', '', $_GET['load'] ); $load = array_unique( explode( ',', $load ) ); if ( empty($load) ) exit; $compress = ( isset($_GET['c']) && $_GET['c'] ); $force_gzip = ( $compress && 'gzip' == $_GET['c'] ); $rtl = ( isset($_GET['dir']) && 'rtl' == $_GET['dir'] ); $expires_offset = 31536000; // 1 year $out = ''; $wp_styles = new WP_Styles(); wp_default_styles($wp_styles); foreach( $load as $handle ) { if ( !array_key_exists($handle, $wp_styles->registered) ) continue; $style = $wp_styles->registered[$handle]; $path = ABSPATH . $style->src; if ( $rtl && ! empty( $style->extra['rtl'] ) ) { // All default styles have fully independent RTL files. $path = str_replace( '.min.css', '-rtl.min.css', $path ); } $content = get_file( $path ) . "\n"; if ( strpos( $style->src, '/wp-includes/css/' ) === 0 ) { $content = str_replace( '../images/', '../wp-includes/images/', $content ); $content = str_replace( '../js/tinymce/', '../wp-includes/js/tinymce/', $content ); $content = str_replace( '../fonts/', '../wp-includes/fonts/', $content ); $out .= $content; } else { $out .= str_replace( '../images/', 'images/', $content ); } } header('Content-Type: text/css; charset=UTF-8'); header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT'); header("Cache-Control: public, max-age=$expires_offset"); if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) { header('Vary: Accept-Encoding'); // Handle proxies if ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) { header('Content-Encoding: deflate'); $out = gzdeflate( $out, 3 ); } elseif ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) { header('Content-Encoding: gzip'); $out = gzencode( $out, 3 ); } } echo $out; exit;
01-wordpress-paypal
trunk/wp-admin/load-styles.php
PHP
gpl3
3,187
<?php /** * Post advanced form for inclusion in the administration panels. * * @package WordPress * @subpackage Administration */ // don't load directly if ( !defined('ABSPATH') ) die('-1'); wp_enqueue_script('post'); if ( wp_is_mobile() ) wp_enqueue_script( 'jquery-touch-punch' ); /** * Post ID global * @name $post_ID * @var int */ $post_ID = isset($post_ID) ? (int) $post_ID : 0; $user_ID = isset($user_ID) ? (int) $user_ID : 0; $action = isset($action) ? $action : ''; $thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ); if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type ) { if ( 0 === strpos( $post->post_mime_type, 'audio/' ) ) { $thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' ); } elseif ( 0 === strpos( $post->post_mime_type, 'video/' ) ) { $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' ); } } if ( $thumbnail_support ) { add_thickbox(); wp_enqueue_media( array( 'post' => $post_ID ) ); } // Add the local autosave notice HTML add_action( 'admin_footer', '_local_storage_notice' ); /* * @todo Document the $messages array(s). */ $messages = array(); $messages['post'] = array( 0 => '', // Unused. Messages start at index 1. 1 => sprintf( __('Post updated. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ), 2 => __('Custom field updated.'), 3 => __('Custom field deleted.'), 4 => __('Post updated.'), /* translators: %s: date and time of the revision */ 5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => sprintf( __('Post published. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ), 7 => __('Post saved.'), 8 => sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), 9 => sprintf( __('Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</a>'), /* translators: Publish box date format, see http://php.net/date */ date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ), 10 => sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), ); $messages['page'] = array( 0 => '', // Unused. Messages start at index 1. 1 => sprintf( __('Page updated. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ), 2 => __('Custom field updated.'), 3 => __('Custom field deleted.'), 4 => __('Page updated.'), 5 => isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => sprintf( __('Page published. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ), 7 => __('Page saved.'), 8 => sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), 9 => sprintf( __('Page scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ), 10 => sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), ); $messages['attachment'] = array_fill( 1, 10, __( 'Media attachment updated.' ) ); // Hack, for now. /** * Filter the post updated messages. * * @since 3.0.0 * * @param array $messages Post updated messages. For defaults @see $messages declarations above. */ $messages = apply_filters( 'post_updated_messages', $messages ); $message = false; if ( isset($_GET['message']) ) { $_GET['message'] = absint( $_GET['message'] ); if ( isset($messages[$post_type][$_GET['message']]) ) $message = $messages[$post_type][$_GET['message']]; elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) ) $message = $messages['post'][$_GET['message']]; } $notice = false; $form_extra = ''; if ( 'auto-draft' == $post->post_status ) { if ( 'edit' == $action ) $post->post_title = ''; $autosave = false; $form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />"; } else { $autosave = wp_get_post_autosave( $post_ID ); } $form_action = 'editpost'; $nonce_action = 'update-post_' . $post_ID; $form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post_ID) . "' />"; // Detect if there exists an autosave newer than the post and if that autosave is different than the post if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) { foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) { if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) { $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) ); break; } } // If this autosave isn't different from the current post, begone. if ( ! $notice ) wp_delete_post_revision( $autosave->ID ); unset($autosave_field, $_autosave_field); } $post_type_object = get_post_type_object($post_type); // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action). require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' ); $publish_callback_args = null; if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) { $revisions = wp_get_post_revisions( $post_ID ); // We should aim to show the revisions metabox only when there are revisions. if ( count( $revisions ) > 1 ) { reset( $revisions ); // Reset pointer for key() $publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => key( $revisions ) ); add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core'); } } if ( 'attachment' == $post_type ) { wp_enqueue_script( 'image-edit' ); wp_enqueue_style( 'imgareaselect' ); add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core' ); add_action( 'edit_form_after_title', 'edit_form_image_editor' ); if ( 0 === strpos( $post->post_mime_type, 'audio/' ) ) { add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core' ); } } else { add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args ); } if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core' ); // all taxonomies foreach ( get_object_taxonomies( $post ) as $tax_name ) { $taxonomy = get_taxonomy( $tax_name ); if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) continue; $label = $taxonomy->labels->name; if ( ! is_taxonomy_hierarchical( $tax_name ) ) $tax_meta_box_id = 'tagsdiv-' . $tax_name; else $tax_meta_box_id = $tax_name . 'div'; add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name ) ); } if ( post_type_supports($post_type, 'page-attributes') ) add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core'); if ( $thumbnail_support ) add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low'); if ( post_type_supports($post_type, 'excerpt') ) add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core'); if ( post_type_supports($post_type, 'trackbacks') ) add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core'); if ( post_type_supports($post_type, 'custom-fields') ) add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core'); /** * Fires in the middle of built-in meta box registration. * * @since 2.1.0 * @deprecated 3.7.0 Use 'add_meta_boxes' instead. * * @param WP_Post $post Post object. */ do_action( 'dbx_post_advanced', $post ); if ( post_type_supports($post_type, 'comments') ) add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core'); if ( ( 'publish' == get_post_status( $post ) || 'private' == get_post_status( $post ) ) && post_type_supports($post_type, 'comments') ) add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core'); if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core'); if ( post_type_supports($post_type, 'author') ) { if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core'); } /** * Fires after all built-in meta boxes have been added. * * @since 3.0.0 * * @param string $post_type Post type. * @param WP_Post $post Post object. */ do_action( 'add_meta_boxes', $post_type, $post ); /** * Fires after all built-in meta boxes have been added, contextually for the given post type. * * The dynamic portion of the hook, $post_type, refers to the post type of the post. * * @since 3.0.0 * * @param WP_Post $post Post object. */ do_action( 'add_meta_boxes_' . $post_type, $post ); /** * Fires after meta boxes have been added. * * Fires once for each of the default meta box contexts: normal, advanced, and side. * * @since 3.0.0 * * @param string $post_type Post type of the post. * @param string $context string Meta box context. * @param WP_Post $post Post object. */ do_action( 'do_meta_boxes', $post_type, 'normal', $post ); /** This action is documented in wp-admin/edit-form-advanced.php */ do_action( 'do_meta_boxes', $post_type, 'advanced', $post ); /** This action is documented in wp-admin/edit-form-advanced.php */ do_action( 'do_meta_boxes', $post_type, 'side', $post ); add_screen_option('layout_columns', array('max' => 2, 'default' => 2) ); if ( 'post' == $post_type ) { $customize_display = '<p>' . __('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.') . '</p>'; get_current_screen()->add_help_tab( array( 'id' => 'customize-display', 'title' => __('Customizing This Display'), 'content' => $customize_display, ) ); $title_and_editor = '<p>' . __('<strong>Title</strong> - Enter a title for your post. After you enter a title, you&#8217;ll see the permalink below, which you can edit.') . '</p>'; $title_and_editor .= '<p>' . __('<strong>Post editor</strong> - Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The Text mode allows you to enter HTML along with your post text. Line breaks will be converted to paragraphs automatically. You can insert media files by clicking the icons above the post editor and following the directions. You can go to the distraction-free writing screen via the Fullscreen icon in Visual mode (second to last in the top row) or the Fullscreen button in Text mode (last in the row). Once there, you can make buttons visible by hovering over the top area. Exit Fullscreen back to the regular post editor.') . '</p>'; $title_and_editor .= '<p>' . __( 'Keyboard users: When you&#8217;re working in the visual editor, you can use <kbd>Alt + F10</kbd> to access the toolbar.' ) . '</p>'; get_current_screen()->add_help_tab( array( 'id' => 'title-post-editor', 'title' => __('Title and Post Editor'), 'content' => $title_and_editor, ) ); get_current_screen()->set_help_sidebar( '<p>' . sprintf(__('You can also create posts with the <a href="%s">Press This bookmarklet</a>.'), 'options-writing.php') . '</p>' . '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Posts_Add_New_Screen" target="_blank">Documentation on Writing and Editing Posts</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); } elseif ( 'page' == $post_type ) { $about_pages = '<p>' . __('Pages are similar to Posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest Pages under other Pages by making one the &#8220;Parent&#8221; of the other, creating a group of Pages.') . '</p>' . '<p>' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box:') . '</p>'; get_current_screen()->add_help_tab( array( 'id' => 'about-pages', 'title' => __('About Pages'), 'content' => $about_pages, ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Pages_Add_New_Screen" target="_blank">Documentation on Adding New Pages</a>') . '</p>' . '<p>' . __('<a href="http://codex.wordpress.org/Pages_Screen#Editing_Individual_Pages" target="_blank">Documentation on Editing Pages</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); } elseif ( 'attachment' == $post_type ) { get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('This screen allows you to edit four fields for metadata in a file within the media library.') . '</p>' . '<p>' . __('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.') . '</p>' . '<p>' . __('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.') . '</p>' . '<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>' ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); } if ( 'post' == $post_type || 'page' == $post_type ) { $inserting_media = '<p>' . __( 'You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the &#8220;Create a new gallery&#8221; button.' ) . '</p>'; $inserting_media .= '<p>' . __( 'You can also embed media from many popular websites including Twitter, YouTube, Flickr and others by pasting the media URL on its own line into the content of your post/page. Please refer to the Codex to <a href="http://codex.wordpress.org/Embeds">learn more about embeds</a>.' ) . '</p>'; get_current_screen()->add_help_tab( array( 'id' => 'inserting-media', 'title' => __( 'Inserting Media' ), 'content' => $inserting_media, ) ); } if ( 'post' == $post_type ) { $publish_box = '<p>' . __('Several boxes on this screen contain settings for how your content will be published, including:') . '</p>'; $publish_box .= '<ul><li>' . __('<strong>Publish</strong> - You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.') . '</li>'; if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) { $publish_box .= '<li>' . __( '<strong>Format</strong> - Post Formats designate how your theme will display a specific post. For example, you could have a <em>standard</em> blog post with a title and paragraphs, or a short <em>aside</em> that omits the title and contains a short text blurb. Please refer to the Codex for <a href="http://codex.wordpress.org/Post_Formats#Supported_Formats">descriptions of each post format</a>. Your theme could enable all or some of 10 possible formats.' ) . '</li>'; } if ( current_theme_supports( 'post-thumbnails' ) && post_type_supports( 'post', 'thumbnail' ) ) { $publish_box .= '<li>' . __('<strong>Featured Image</strong> - This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the featured image as a post thumbnail on the home page, a custom header, etc.') . '</li>'; } $publish_box .= '</ul>'; get_current_screen()->add_help_tab( array( 'id' => 'publish-box', 'title' => __('Publish Settings'), 'content' => $publish_box, ) ); $discussion_settings = '<p>' . __('<strong>Send Trackbacks</strong> - Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they&#8217;ll be notified automatically using pingbacks, and this field is unnecessary.') . '</p>'; $discussion_settings .= '<p>' . __('<strong>Discussion</strong> - You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.') . '</p>'; get_current_screen()->add_help_tab( array( 'id' => 'discussion-settings', 'title' => __('Discussion Settings'), 'content' => $discussion_settings, ) ); } elseif ( 'page' == $post_type ) { $page_attributes = '<p>' . __('<strong>Parent</strong> - You can arrange your pages in hierarchies. For example, you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how many levels you can nest pages.') . '</p>' . '<p>' . __('<strong>Template</strong> - Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&#8217;ll see them in this dropdown menu.') . '</p>' . '<p>' . __('<strong>Order</strong> - Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.') . '</p>'; get_current_screen()->add_help_tab( array( 'id' => 'page-attributes', 'title' => __('Page Attributes'), 'content' => $page_attributes, ) ); } require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?> <div class="wrap"> <h2><?php echo esc_html( $title ); if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) ) echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="add-new-h2">' . esc_html( $post_type_object->labels->add_new ) . '</a>'; ?></h2> <?php if ( $notice ) : ?> <div id="notice" class="error"><p id="has-newer-autosave"><?php echo $notice ?></p></div> <?php endif; ?> <?php if ( $message ) : ?> <div id="message" class="updated"><p><?php echo $message; ?></p></div> <?php endif; ?> <div id="lost-connection-notice" class="error hidden"> <p><span class="spinner"></span> <?php _e( '<strong>Connection lost.</strong> Saving has been disabled until you&#8217;re reconnected.' ); ?> <span class="hide-if-no-sessionstorage"><?php _e( 'We&#8217;re backing up this post in your browser, just in case.' ); ?></span> </p> </div> <?php /** * Fires inside the post editor <form> tag. * * @since 3.0.0 * * @param WP_Post $post Post object. */ ?> <form name="post" action="post.php" method="post" id="post"<?php do_action( 'post_edit_form_tag', $post ); ?>> <?php wp_nonce_field($nonce_action); ?> <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" /> <input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr( $form_action ) ?>" /> <input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ) ?>" /> <input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" /> <input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ) ?>" /> <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status) ?>" /> <input type="hidden" id="referredby" name="referredby" value="<?php echo esc_url(wp_get_referer()); ?>" /> <?php if ( ! empty( $active_post_lock ) ) { ?> <input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" /> <?php } if ( 'draft' != get_post_status( $post ) ) wp_original_referer_field(true, 'previous'); echo $form_extra; wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> <?php /** * Fires at the beginning of the edit form. * * At this point, the required hidden fields and nonces have already been output. * * @since 3.7.0 * * @param WP_Post $post Post object. */ do_action( 'edit_form_top', $post ); ?> <div id="poststuff"> <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> <div id="post-body-content"> <?php if ( post_type_supports($post_type, 'title') ) { ?> <div id="titlediv"> <div id="titlewrap"> <?php /** * Filter the title field placeholder text. * * @since 3.1.0 * * @param string $text Placeholder text. Default 'Enter title here'. * @param WP_Post $post Post object. */ ?> <label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); ?></label> <input type="text" name="post_title" size="30" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" autocomplete="off" /> </div> <div class="inside"> <?php $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : ''; $shortlink = wp_get_shortlink($post->ID, 'post'); $permalink = get_permalink( $post->ID ); if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ) $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>'; if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status; ?> <div id="edit-slug-box" class="hide-if-no-js"> <?php if ( $has_sample_permalink ) echo $sample_permalink_html; ?> </div> <?php } ?> </div> <?php wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); ?> </div><!-- /titlediv --> <?php } /** * Fires after the title field. * * @since 3.5.0 * * @param WP_Post $post Post object. */ do_action( 'edit_form_after_title', $post ); if ( post_type_supports($post_type, 'editor') ) { ?> <div id="postdivrich" class="postarea edit-form-section"> <?php wp_editor( $post->post_content, 'content', array( 'dfw' => true, 'drag_drop_upload' => true, 'tabfocus_elements' => 'insert-media-button,save-post', 'editor_height' => 360, 'tinymce' => array( 'resize' => false, 'add_unload_trigger' => false, ), ) ); ?> <table id="post-status-info"><tbody><tr> <td id="wp-word-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td> <td class="autosave-info"> <span class="autosave-message">&nbsp;</span> <?php if ( 'auto-draft' != $post->post_status ) { echo '<span id="last-edit">'; if ( $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ) ) { printf(__('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); } else { printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); } echo '</span>'; } ?> </td> <td id="content-resize-handle" class="hide-if-no-js"><br /></td> </tr></tbody></table> </div> <?php } /** * Fires after the content editor. * * @since 3.5.0 * * @param WP_Post $post Post object. */ do_action( 'edit_form_after_editor', $post ); ?> </div><!-- /post-body-content --> <div id="postbox-container-1" class="postbox-container"> <?php if ( 'page' == $post_type ) { /** * Fires before meta boxes with 'side' context are output for the 'page' post type. * * The submitpage box is a meta box with 'side' context, so this hook fires just before it is output. * * @since 2.5.0 * * @param WP_Post $post Post object. */ do_action( 'submitpage_box', $post ); } else { /** * Fires before meta boxes with 'side' context are output for all post types other than 'page'. * * The submitpost box is a meta box with 'side' context, so this hook fires just before it is output. * * @since 2.5.0 * * @param WP_Post $post Post object. */ do_action( 'submitpost_box', $post ); } do_meta_boxes($post_type, 'side', $post); ?> </div> <div id="postbox-container-2" class="postbox-container"> <?php do_meta_boxes(null, 'normal', $post); if ( 'page' == $post_type ) { /** * Fires after 'normal' context meta boxes have been output for the 'page' post type. * * @since 1.5.0 * * @param WP_Post $post Post object. */ do_action( 'edit_page_form', $post ); } else { /** * Fires after 'normal' context meta boxes have been output for all post types other than 'page'. * * @since 1.5.0 * * @param WP_Post $post Post object. */ do_action( 'edit_form_advanced', $post ); } do_meta_boxes(null, 'advanced', $post); ?> </div> <?php /** * Fires after all meta box sections have been output, before the closing #post-body div. * * @since 2.1.0 * * @param WP_Post $post Post object. */ do_action( 'dbx_post_sidebar', $post ); ?> </div><!-- /post-body --> <br class="clear" /> </div><!-- /poststuff --> </form> </div> <?php if ( post_type_supports( $post_type, 'comments' ) ) wp_comment_reply(); ?> <?php if ( post_type_supports( $post_type, 'title' ) && '' === $post->post_title ) : ?> <script type="text/javascript"> try{document.post.title.focus();}catch(e){} </script> <?php endif; ?>
01-wordpress-paypal
trunk/wp-admin/edit-form-advanced.php
PHP
gpl3
28,752
<?php /** * Add Link Administration Screen. * * @package WordPress * @subpackage Administration */ /** Load WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); if ( ! current_user_can('manage_links') ) wp_die(__('You do not have sufficient permissions to add links to this site.')); $title = __('Add New Link'); $parent_file = 'link-manager.php'; wp_reset_vars( array('action', 'cat_id', 'link_id' ) ); wp_enqueue_script('link'); wp_enqueue_script('xfn'); if ( wp_is_mobile() ) wp_enqueue_script( 'jquery-touch-punch' ); $link = get_default_link_to_edit(); include( ABSPATH . 'wp-admin/edit-link-form.php' ); require( ABSPATH . 'wp-admin/admin-footer.php' );
01-wordpress-paypal
trunk/wp-admin/link-add.php
PHP
gpl3
712
<?php /** * Permalink Settings Administration Screen. * * @package WordPress * @subpackage Administration */ /** WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); if ( ! current_user_can( 'manage_options' ) ) wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) ); $title = __('Permalink Settings'); $parent_file = 'options-general.php'; get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change &#8212; hence the name permalink.') . '</p>' . '<p>' . __('This screen allows you to choose your default permalink structure. You can choose from common settings or create custom URL structures.') . '</p>' . '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>', ) ); get_current_screen()->add_help_tab( array( 'id' => 'common-settings', 'title' => __('Common Settings'), 'content' => '<p>' . __('Many people choose to use &#8220;pretty permalinks,&#8221; URLs that contain useful information such as the post title rather than generic post ID numbers. You can choose from any of the permalink formats under Common Settings, or can craft your own if you select Custom Structure.') . '</p>' . '<p>' . __('If you pick an option other than Default, your general URL path with structure tags, terms surrounded by <code>%</code>, will also appear in the custom structure field and your path can be further modified there.') . '</p>' . '<p>' . __('When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes <code>%category%</code> or <code>%tag%</code>.') . '</p>' . '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>', ) ); get_current_screen()->add_help_tab( array( 'id' => 'custom-structures', 'title' => __('Custom Structures'), 'content' => '<p>' . __('The Optional fields let you customize the &#8220;category&#8221; and &#8220;tag&#8221; base names that will appear in archive URLs. For example, the page listing all posts in the &#8220;Uncategorized&#8221; category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.') . '</p>' . '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>', ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Settings_Permalinks_Screen" target="_blank">Documentation on Permalinks Settings</a>') . '</p>' . '<p>' . __('<a href="http://codex.wordpress.org/Using_Permalinks" target="_blank">Documentation on Using Permalinks</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); /** * Display JavaScript on the page. * * @since 3.5.0 */ function options_permalink_add_js() { ?> <script type="text/javascript"> //<![CDATA[ jQuery(document).ready(function() { jQuery('.permalink-structure input:radio').change(function() { if ( 'custom' == this.value ) return; jQuery('#permalink_structure').val( this.value ); }); jQuery('#permalink_structure').focus(function() { jQuery("#custom_selection").attr('checked', 'checked'); }); }); //]]> </script> <?php } add_filter('admin_head', 'options_permalink_add_js'); $home_path = get_home_path(); $iis7_permalinks = iis7_supports_permalinks(); $prefix = $blog_prefix = ''; if ( ! got_url_rewrite() ) $prefix = '/index.php'; if ( is_multisite() && !is_subdomain_install() && is_main_site() ) $blog_prefix = '/blog'; if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { check_admin_referer('update-permalink'); if ( isset( $_POST['permalink_structure'] ) ) { if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] ) $permalink_structure = $_POST['selection']; else $permalink_structure = $_POST['permalink_structure']; if ( ! empty( $permalink_structure ) ) { $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); if ( $prefix && $blog_prefix ) $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure ); else $permalink_structure = $blog_prefix . $permalink_structure; } $wp_rewrite->set_permalink_structure( $permalink_structure ); } if ( isset( $_POST['category_base'] ) ) { $category_base = $_POST['category_base']; if ( ! empty( $category_base ) ) $category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); $wp_rewrite->set_category_base( $category_base ); } if ( isset( $_POST['tag_base'] ) ) { $tag_base = $_POST['tag_base']; if ( ! empty( $tag_base ) ) $tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); $wp_rewrite->set_tag_base( $tag_base ); } wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) ); exit; } $permalink_structure = get_option( 'permalink_structure' ); $category_base = get_option( 'category_base' ); $tag_base = get_option( 'tag_base' ); $update_required = false; if ( $iis7_permalinks ) { if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') ) $writable = true; else $writable = false; } elseif ( $is_nginx ) { $writable = false; } else { if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) { $writable = true; } else { $writable = false; $existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) ); $new_rules = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) ); $update_required = ( $new_rules !== $existing_rules ); } } if ( $wp_rewrite->using_index_permalinks() ) $usingpi = true; else $usingpi = false; flush_rewrite_rules(); require( ABSPATH . 'wp-admin/admin-header.php' ); if ( ! empty( $_GET['settings-updated'] ) ) : ?> <div id="message" class="updated"><p><?php if ( ! is_multisite() ) { if ( $iis7_permalinks ) { if ( $permalink_structure && ! $usingpi && ! $writable ) _e('You should update your web.config now.'); else if ( $permalink_structure && ! $usingpi && $writable ) _e('Permalink structure updated. Remove write access on web.config file now!'); else _e('Permalink structure updated.'); } elseif ( $is_nginx ) { _e('Permalink structure updated.'); } else { if ( $permalink_structure && ! $usingpi && ! $writable && $update_required ) { _e('You should update your .htaccess now.'); } else { _e('Permalink structure updated.'); } } } else { _e('Permalink structure updated.'); } ?> </p></div> <?php endif; ?> <div class="wrap"> <h2><?php echo esc_html( $title ); ?></h2> <form name="form" action="options-permalink.php" method="post"> <?php wp_nonce_field('update-permalink') ?> <p><?php _e('By default WordPress uses web <abbr title="Universal Resource Locator">URL</abbr>s which have question marks and lots of numbers in them; however, WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p> <?php if ( is_multisite() && !is_subdomain_install() && is_main_site() ) { $permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure ); $category_base = preg_replace( '|^/?blog|', '', $category_base ); $tag_base = preg_replace( '|^/?blog|', '', $tag_base ); } $structures = array( 0 => '', 1 => $prefix . '/%year%/%monthnum%/%day%/%postname%/', 2 => $prefix . '/%year%/%monthnum%/%postname%/', 3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%', 4 => $prefix . '/%postname%/', ); ?> <h3 class="title"><?php _e('Common Settings'); ?></h3> <table class="form-table permalink-structure"> <tr> <th><label><input name="selection" type="radio" value="" <?php checked('', $permalink_structure); ?> /> <?php _e('Default'); ?></label></th> <td><code><?php echo get_option('home'); ?>/?p=123</code></td> </tr> <tr> <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[1]); ?>" <?php checked($structures[1], $permalink_structure); ?> /> <?php _e('Day and name'); ?></label></th> <td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td> </tr> <tr> <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[2]); ?>" <?php checked($structures[2], $permalink_structure); ?> /> <?php _e('Month and name'); ?></label></th> <td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td> </tr> <tr> <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[3]); ?>" <?php checked($structures[3], $permalink_structure); ?> /> <?php _e('Numeric'); ?></label></th> <td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/123'; ?></code></td> </tr> <tr> <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[4]); ?>" <?php checked($structures[4], $permalink_structure); ?> /> <?php _e('Post name'); ?></label></th> <td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td> </tr> <tr> <th> <label><input name="selection" id="custom_selection" type="radio" value="custom" <?php checked( !in_array($permalink_structure, $structures) ); ?> /> <?php _e('Custom Structure'); ?> </label> </th> <td> <code><?php echo get_option('home') . $blog_prefix; ?></code> <input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo esc_attr($permalink_structure); ?>" class="regular-text code" /> </td> </tr> </table> <h3 class="title"><?php _e('Optional'); ?></h3> <?php $suffix = $prefix; if ( $suffix ) $suffix = ltrim( $suffix, '/' ) . '/'; ?> <p><?php /* translators: %s is a placeholder that must come at the start of the URL path. */ printf( __('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>topics</code> as your category base would make your category links like <code>http://example.org/%stopics/uncategorized/</code>. If you leave these blank the defaults will be used.'), $suffix ); ?></p> <table class="form-table"> <tr> <th><label for="category_base"><?php /* translators: prefix for category permalinks */ _e('Category base'); ?></label></th> <td><?php echo $blog_prefix; ?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr( $category_base ); ?>" class="regular-text code" /></td> </tr> <tr> <th><label for="tag_base"><?php _e('Tag base'); ?></label></th> <td><?php echo $blog_prefix; ?> <input name="tag_base" id="tag_base" type="text" value="<?php echo esc_attr($tag_base); ?>" class="regular-text code" /></td> </tr> <?php do_settings_fields('permalink', 'optional'); ?> </table> <?php do_settings_sections('permalink'); ?> <?php submit_button(); ?> </form> <?php if ( !is_multisite() ) { ?> <?php if ( $iis7_permalinks ) : if ( isset($_POST['submit']) && $permalink_structure && ! $usingpi && ! $writable ) : if ( file_exists($home_path . 'web.config') ) : ?> <p><?php _e('If your <code>web.config</code> file were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so this is the url rewrite rule you should have in your <code>web.config</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all. Then insert this rule inside of the <code>/&lt;configuration&gt;/&lt;system.webServer&gt;/&lt;rewrite&gt;/&lt;rules&gt;</code> element in <code>web.config</code> file.') ?></p> <form action="options-permalink.php" method="post"> <?php wp_nonce_field('update-permalink') ?> <p><textarea rows="9" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules() ); ?></textarea></p> </form> <p><?php _e('If you temporarily make your <code>web.config</code> file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.') ?></p> <?php else : ?> <p><?php _e('If the root directory of your site were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so this is the url rewrite rule you should have in your <code>web.config</code> file. Create a new file, called <code>web.config</code> in the root directory of your site. Click in the field and press <kbd>CTRL + a</kbd> to select all. Then insert this code into the <code>web.config</code> file.') ?></p> <form action="options-permalink.php" method="post"> <?php wp_nonce_field('update-permalink') ?> <p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules(true) ); ?></textarea></p> </form> <p><?php _e('If you temporarily make your site&#8217;s root directory writable for us to generate the <code>web.config</code> file automatically, do not forget to revert the permissions after the file has been created.') ?></p> <?php endif; ?> <?php endif; ?> <?php elseif ( ! $is_nginx ) : if ( $permalink_structure && ! $usingpi && ! $writable && $update_required ) : ?> <p><?php _e('If your <code>.htaccess</code> file were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p> <form action="options-permalink.php" method="post"> <?php wp_nonce_field('update-permalink') ?> <p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->mod_rewrite_rules() ); ?></textarea></p> </form> <?php endif; ?> <?php endif; ?> <?php } // multisite ?> </div> <?php require( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
01-wordpress-paypal
trunk/wp-admin/options-permalink.php
PHP
gpl3
15,251
<?php /** * About This Version administration panel. * * @package WordPress * @subpackage Administration */ /** WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); wp_enqueue_style( 'wp-mediaelement' ); wp_enqueue_script( 'wp-playlist' ); add_action( 'admin_footer', 'wp_underscore_playlist_templates', 0 ); $title = __( 'About' ); list( $display_version ) = explode( '-', $wp_version ); include( ABSPATH . 'wp-admin/admin-header.php' ); ?> <!--[if lt IE 9]><script>document.createElement('audio');document.createElement('video');</script><![endif]--> <div class="wrap about-wrap"> <h1><?php printf( __( 'Welcome to WordPress&nbsp;%s' ), $display_version ); ?></h1> <div class="about-text"><?php printf( __( 'Thank you for updating! WordPress %s has lots of refinements we think you&#8217;ll love.' ), $display_version ); ?></div> <div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div> <h2 class="nav-tab-wrapper"> <a href="about.php" class="nav-tab nav-tab-active"> <?php _e( 'What&#8217;s New' ); ?> </a><a href="credits.php" class="nav-tab"> <?php _e( 'Credits' ); ?> </a><a href="freedoms.php" class="nav-tab"> <?php _e( 'Freedoms' ); ?> </a> </h2> <div class="changelog"> <div class="about-overview"> <?php if ( ( $locale = get_locale() ) && 'en_' === substr( $locale, 0, 3 ) ) : ?> <embed src="//v0.wordpress.com/player.swf?v=1.03" type="application/x-shockwave-flash" width="640" height="360" wmode="direct" seamlesstabbing="true" allowfullscreen="true" allowscriptaccess="always" overstretch="true" flashvars="guid=sAiXhCfV&amp;isDynamicSeeking=true" title=""></embed> <?php else : ?> <img class="about-overview-img" src="//s.w.org/images/core/3.9/overview.png?0" /> <?php endif; ?> </div> <h2 class="about-headline-callout"><?php _e( 'A smoother media editing&nbsp;experience' ); ?></h2> <div class="feature-section col three-col"> <div class="col-1"> <img src="//s.w.org/images/core/3.9/editor.jpg?0" /> <h4><?php _e( 'Improved visual editing' ); ?></h4> <p><?php _e( 'The updated visual editor has improved speed, accessibility, and mobile support.' ); echo ' ' . __( 'You can paste into the visual editor from your word processor without wasting time to clean up messy styling. (Yeah, we&#8217;re talking about you, Microsoft Word.)' ); ?></p> </div> <div class="col-2"> <img src="//s.w.org/images/core/3.9/image.gif?0" /> <h4><?php _e( 'Edit images easily' ); ?></h4> <p><?php _e( 'With quicker access to crop and rotation tools, it&#8217;s now much easier to edit your images while editing posts. You can also scale images directly in the editor to find just the right fit.' ); ?></p> </div> <div class="col-3 last-feature"> <img src="//s.w.org/images/core/3.9/drop.jpg?0" /> <h4><?php _e( 'Drag and drop your images' ); ?></h4> <p><?php _e( 'Uploading your images is easier than ever. Just grab them from your desktop and drop them onto the editor.' ); ?></p> </div> </div> <hr> <div class="feature-section col two-col"> <div class="col-1"> <img src="//s.w.org/images/core/3.9/gallery.jpg?0" /> <h4><?php _e( 'Gallery previews' ); ?></h4> <p><?php _e( 'Galleries display a beautiful grid of images right in the editor, just like they do in your published post.' ); ?></p> </div> <div class="col-2 last-feature"> <div class="wp-playlist wp-audio-playlist wp-playlist-light"> <div class="wp-playlist-current-item"></div> <audio controls="controls" preload="metadata"></audio> <div class="wp-playlist-next"></div> <div class="wp-playlist-prev"></div> <?php $audio_icon_js = esc_js( includes_url( 'images/media/audio.png' ) ); $wp_host = '//s.w.org/images/core/3.9/'; ?> <script type="application/json">{ "type":"audio", "tracklist":true, "tracknumbers":true, "images":true, "artists":true, "tracks":[{ "src":"<?php echo $wp_host ?>AintMisbehavin.mp3", "type":"audio\/mpeg","title":"Ain't Misbehavin'","caption":"","description":"", "meta":{ "artist":"Louis Armstrong & His Orchestra", "album":"78 RPMs & Cylinder Recordings", "genre":"Jazz", "length_formatted":"3:21" }, "image":{"src":"//s.w.org/images/core/3.9/louis.jpg","width":308,"height":240}, "thumb":{"src":"//s.w.org/images/core/3.9/louis.jpg","width":308,"height":240} }, { "src":"<?php echo $wp_host ?>JellyRollMorton-BuddyBoldensBlues.mp3", "type":"audio\/mpeg","title":"Buddy Bolden's Blues","caption":"","description":"", "meta":{ "artist":"Jelly Roll Morten", "album":"78 RPMs & Cylinder Recordings", "genre":"Jazz", "length_formatted":"2:09" }, "image":{"src":"<?php echo $audio_icon_js ?>","width":48,"height":64}, "thumb":{"src":"<?php echo $audio_icon_js ?>","width":48,"height":64} }, { "src":"<?php echo $wp_host ?>DavenportBlues.mp3", "type":"audio\/mpeg","title":"Davenport Blues","caption":"","description":"", "meta":{ "artist":"Bix Beiderbecke & His Rhythm Jugglers", "album":"78 RPMs & Cylinder Recordings", "genre":"Jazz", "length_formatted":"2:48" }, "image":{"src":"<?php echo $audio_icon_js ?>","width":48,"height":64}, "thumb":{"src":"<?php echo $audio_icon_js ?>","width":48,"height":64} }, { "src":"<?php echo $wp_host ?>WolverineBlues.mp3", "type":"audio\/mpeg","title":"Wolverine Blues","caption":"","description":"", "meta":{ "artist":"Benny Goodman's Boys", "album":"78 RPMs & Cylinder Recordings", "genre":"Jazz", "length_formatted":"2:55" }, "image":{"src":"<?php echo $audio_icon_js ?>","width":48,"height":64}, "thumb":{"src":"<?php echo $audio_icon_js ?>","width":48,"height":64} }, { "src":"<?php echo $wp_host ?>Louisiana_Five-Dixie_Blues-1919.mp3", "type":"audio\/mpeg","title":"Dixie Blues","caption":"","description":"", "meta":{ "artist":"Louisiana Five", "album":"78 RPMs & Cylinder Recordings", "genre":"Jazz", "length_formatted":"3:01" }, "image":{"src":"<?php echo $audio_icon_js ?>","width":48,"height":64}, "thumb":{"src":"<?php echo $audio_icon_js ?>","width":48,"height":64} }, { "src":"<?php echo $wp_host ?>Johnny_Hodges_Orchestra-Squaty_Roo-1941.mp3", "type":"audio\/mpeg","title":"Squaty Roo","caption":"","description":"", "meta":{ "artist":"Johnny Hodges Orchestra", "album":"78 RPMs & Cylinder Recordings", "genre":"Jazz", "length_formatted":"2:24" }, "image":{"src":"<?php echo $audio_icon_js ?>","width":48,"height":64}, "thumb":{"src":"<?php echo $audio_icon_js ?>","width":48,"height":64} }] }</script> </div> <h4><?php _e( 'Do more with audio and video' ); ?></h4> <p><?php _e( 'Images have galleries; now we&#8217;ve added simple audio and video playlists, so you can showcase your music and clips.' ); ?></p> </div> </div> </div> <hr> <div class="changelog customize"> <div class="feature-section col two-col"> <div> <?php echo wp_video_shortcode( array( 'mp4' => '//s.w.org/images/core/3.9/widgets.mp4', 'ogv' => '//s.w.org/images/core/3.9/widgets.ogv', 'webm' => '//s.w.org/images/core/3.9/widgets.webm', 'loop' => true, 'autoplay' => true, 'width' => 499 ) ); ?> <h4><?php _e( 'Live widget and header previews' ); ?></h4> <p><?php _e( 'Add, edit, and rearrange your site&#8217;s widgets right in the theme customizer. No &#8220;save and surprise&#8221; &mdash; preview your changes live and only save them when you&#8217;re ready.' ); ?></p> <p><?php _e( 'The improved header image tool also lets you upload, crop, and manage headers while customizing your theme.' ); ?></p> </div> <div class="last-feature"> <img src="//s.w.org/images/core/3.9/theme.jpg?0" /> <h4><?php _e( 'Stunning new theme browser' ); ?></h4> <p><?php _e( 'Looking for a new theme should be easy and fun. Lose yourself in the boundless supply of free WordPress.org themes with the beautiful new theme browser.' ); ?></p> <?php if ( current_user_can( 'install_themes' ) ) { ?> <p><a href="<?php echo network_admin_url( 'theme-install.php' ); ?>" class="button button-large button-primary"><?php _e( 'Browse Themes' ); ?></a></p> <?php } ?> </div> </div> </div> <hr> <div class="changelog under-the-hood"> <h3><?php _e( 'Under the Hood' ); ?></h3> <div class="feature-section col three-col"> <div> <h4><?php _e( 'Semantic Captions and Galleries' ); ?></h4> <p><?php _e( 'Theme developers have new options for images and galleries that use intelligent HTML5 markup.' ); ?></p> <h4><?php _e( 'Inline Code Documentation' ); ?></h4> <p><?php _e( 'Every action and filter hook in WordPress is now documented, along with expanded documentation for the media manager and customizer APIs.' ); ?></p> </div> <div> <h4><?php _e( 'External Libraries' ); ?></h4> <p><?php _e( 'Updated libraries: TinyMCE&nbsp;4, jQuery&nbsp;1.11, Backbone&nbsp;1.1, Underscore&nbsp;1.6, Plupload&nbsp;2, MediaElement&nbsp;2.14, Masonry&nbsp;3.' ); ?></p> <h4><?php _e( 'Improved Database Layer' ); ?></h4> <p><?php _e( 'Database connections are now more fault-resistant and have improved compatibility with PHP 5.5 and MySQL 5.6.' ); ?></p> </div> <div class="last-feature"> <h4><?php _e( 'New Utility Functions' ); ?></h4> <p><?php _e( 'Identify a hook in progress with <code>doing_action()</code> and <code>doing_filter()</code>, and manipulate custom image sizes with <code>has_image_size()</code> and <code>remove_image_size()</code>.' ); ?></p> <p><?php _e( 'Plugins and themes registering custom image sizes can now register suggested cropping points. For example, prevent heads from being cropped out of photos with a top-center crop.' ); ?></p> </div> </div> <hr> <div class="return-to-dashboard"> <?php if ( current_user_can( 'update_core' ) && isset( $_GET['updated'] ) ) : ?> <a href="<?php echo esc_url( self_admin_url( 'update-core.php' ) ); ?>"><?php is_multisite() ? _e( 'Return to Updates' ) : _e( 'Return to Dashboard &rarr; Updates' ); ?></a> | <?php endif; ?> <a href="<?php echo esc_url( self_admin_url() ); ?>"><?php is_blog_admin() ? _e( 'Go to Dashboard &rarr; Home' ) : _e( 'Go to Dashboard' ); ?></a> </div> </div> <?php include( ABSPATH . 'wp-admin/admin-footer.php' ); // These are strings we may use to describe maintenance/security releases, where we aim for no new strings. return; _n_noop( 'Maintenance Release', 'Maintenance Releases' ); _n_noop( 'Security Release', 'Security Releases' ); _n_noop( 'Maintenance and Security Release', 'Maintenance and Security Releases' ); /* translators: 1: WordPress version number. */ _n_noop( '<strong>Version %1$s</strong> addressed a security issue.', '<strong>Version %1$s</strong> addressed some security issues.' ); /* translators: 1: WordPress version number, 2: plural number of bugs. */ _n_noop( '<strong>Version %1$s</strong> addressed %2$s bug.', '<strong>Version %1$s</strong> addressed %2$s bugs.' ); /* translators: 1: WordPress version number, 2: plural number of bugs. Singular security issue. */ _n_noop( '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.', '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.' ); /* translators: 1: WordPress version number, 2: plural number of bugs. More than one security issue. */ _n_noop( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.', '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.' ); __( 'For more information, see <a href="%s">the release notes</a>.' );
01-wordpress-paypal
trunk/wp-admin/about.php
PHP
gpl3
11,990
<?php /** * Install theme administration panel. * * @package WordPress * @subpackage Administration */ /** WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); require( ABSPATH . 'wp-admin/includes/theme-install.php' ); wp_reset_vars( array( 'tab' ) ); if ( ! current_user_can('install_themes') ) wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) ); if ( is_multisite() && ! is_network_admin() ) { wp_redirect( network_admin_url( 'theme-install.php' ) ); exit(); } $title = __( 'Add Themes' ); $parent_file = 'themes.php'; if ( ! is_network_admin() ) { $submenu_file = 'themes.php'; } $sections = array( 'featured' => __( 'Featured Themes' ), 'popular' => __( 'Popular Themes' ), 'new' => __( 'Newest Themes' ), ); $installed_themes = search_theme_directories(); foreach ( $installed_themes as $k => $v ) { if ( false !== strpos( $k, '/' ) ) { unset( $installed_themes[ $k ] ); } } wp_localize_script( 'theme', '_wpThemeSettings', array( 'themes' => false, 'settings' => array( 'isInstall' => true, 'canInstall' => current_user_can( 'install_themes' ), 'installURI' => current_user_can( 'install_themes' ) ? self_admin_url( 'theme-install.php' ) : null, 'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ) ), 'l10n' => array( 'addNew' => __( 'Add New Theme' ), 'search' => __( 'Search Themes' ), 'searchPlaceholder' => __( 'Search themes...' ), // placeholder (no ellipsis) 'upload' => __( 'Upload Theme' ), 'back' => __( 'Back' ), 'error' => __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ) ), 'installedThemes' => array_keys( $installed_themes ), 'browse' => array( 'sections' => $sections, ), ) ); wp_enqueue_script( 'theme' ); /** * Fires before each of the tabs are rendered on the Install Themes page. * * The dynamic portion of the hook name, $tab, refers to the current * theme install tab. Possible values are 'dashboard', 'search', 'upload', * 'featured', 'new', or 'updated'. * * @since 2.8.0 */ if ( $tab ) { do_action( "install_themes_pre_{$tab}" ); } $help_overview = '<p>' . sprintf(__('You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.'), 'https://wordpress.org/themes/') . '</p>' . '<p>' . __('You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter. Alternately, you can browse the themes that are Featured, Newest, or Recently Updated. When you find a theme you like, you can preview it or install it.') . '</p>' . '<p>' . __('You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme&#8217;s folder via FTP into your <code>/wp-content/themes</code> directory.') . '</p>'; get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => $help_overview ) ); $help_installing = '<p>' . __('Once you have generated a list of themes, you can preview and install any of them. Click on the thumbnail of the theme you&#8217;re interested in previewing. It will open up in a full-screen Preview page to give you a better idea of how that theme will look.') . '</p>' . '<p>' . __('To install the theme so you can preview it with your site&#8217;s content and customize its theme options, click the "Install" button at the top of the left-hand pane. The theme files will be downloaded to your website automatically. When this is complete, the theme is now available for activation, which you can do by clicking the "Activate" link, or by navigating to your Manage Themes screen and clicking the "Live Preview" link under any installed theme&#8217;s thumbnail image.') . '</p>'; get_current_screen()->add_help_tab( array( 'id' => 'installing', 'title' => __('Previewing and Installing'), 'content' => $help_installing ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Using_Themes#Adding_New_Themes" target="_blank">Documentation on Adding New Themes</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); include(ABSPATH . 'wp-admin/admin-header.php'); ?> <div class="wrap"> <h2> <?php echo esc_html( $title ); ?> <a href="#" class="upload add-new-h2"><?php _e( 'Upload Theme' ); ?></a> <a href="#" class="browse-themes add-new-h2"><?php _ex( 'Browse', 'themes' ); ?></a> </h2> <div class="upload-theme"> <?php install_themes_upload(); ?> </div> <div class="theme-navigation"> <span class="theme-count"></span> <a class="theme-section" href="#" data-sort="featured"><?php _ex( 'Featured', 'themes' ); ?></a> <a class="theme-section" href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a> <a class="theme-section" href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a> <div class="theme-top-filters"> <!-- <span class="theme-filter" data-filter="photoblogging">Photography</span> <span class="theme-filter" data-filter="responsive-layout">Responsive</span> --> <a class="more-filters" href="#"><?php _e( 'Feature Filter' ); ?></a> </div> <div class="more-filters-container"> <a class="apply-filters button button-secondary" href="#"><?php _e( 'Apply Filters' ); ?><span></span></a> <a class="clear-filters button button-secondary" href="#"><?php _e( 'Clear' ); ?></a> <br class="clear" /> <?php $feature_list = get_theme_feature_list(); foreach ( $feature_list as $feature_name => $features ) { if ( $feature_name === 'Features' || $feature_name === __( 'Features' ) ) { // hack hack hack echo '<div class="filters-group wide-filters-group">'; } else { echo '<div class="filters-group">'; } $feature_name = esc_html( $feature_name ); echo '<h4 class="feature-name">' . $feature_name . '</h4>'; echo '<ol class="feature-group">'; foreach ( $features as $feature => $feature_name ) { $feature = esc_attr( $feature ); echo '<li><input type="checkbox" id="feature-id-' . $feature . '" value="' . $feature . '" /> '; echo '<label for="feature-id-' . $feature . '">' . $feature_name . '</label></li>'; } echo '</ol>'; echo '</div>'; } ?> <div class="filtering-by"> <span><?php _e( 'Filtering by:' ); ?></span> <div class="tags"></div> <a href="#"><?php _e( 'Edit' ); ?></a> </div> </div> </div> <div class="theme-browser"></div> <div class="theme-install-overlay wp-full-overlay expanded"></div> <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p> <span class="spinner"></span> <br class="clear" /> <?php /** * Fires at the top of each of the tabs on the Install Themes page. * * The dynamic portion of the hook name, $tab, refers to the current * theme install tab. Possible values are 'dashboard', 'search', 'upload', * 'featured', 'new', or 'updated'. * * @since 2.8.0 * * @param int $paged Number of the current page of results being viewed. */ if ( $tab ) { do_action( "install_themes_{$tab}", $paged ); } ?> </div> <script id="tmpl-theme" type="text/template"> <# if ( data.screenshot_url ) { #> <div class="theme-screenshot"> <img src="{{ data.screenshot_url }}" alt="" /> </div> <# } else { #> <div class="theme-screenshot blank"></div> <# } #> <span class="more-details"><?php _ex( 'Details &amp; Preview', 'theme' ); ?></span> <div class="theme-author"><?php printf( __( 'By %s' ), '{{ data.author }}' ); ?></div> <h3 class="theme-name">{{ data.name }}</h3> <div class="theme-actions"> <a class="button button-primary" href="{{ data.install_url }}"><?php esc_html_e( 'Install' ); ?></a> <a class="button button-secondary preview install-theme-preview" href="#"><?php esc_html_e( 'Preview' ); ?></a> </div> <# if ( data.installed ) { #> <div class="theme-installed"><?php _e( 'Already Installed' ); ?></div> <# } #> </script> <script id="tmpl-theme-preview" type="text/template"> <div class="wp-full-overlay-sidebar"> <div class="wp-full-overlay-header"> <a href="#" class="close-full-overlay button-secondary"><?php _e( 'Close' ); ?></a> <# if ( data.installed ) { #> <a href="#" class="button button-primary theme-install disabled"><?php _e( 'Installed' ); ?></a> <# } else { #> <a href="{{ data.install_url }}" class="button button-primary theme-install"><?php _e( 'Install' ); ?></a> <# } #> </div> <div class="wp-full-overlay-sidebar-content"> <div class="install-theme-info"> <h3 class="theme-name">{{ data.name }}</h3> <span class="theme-by"><?php printf( __( 'By %s' ), '{{ data.author }}' ); ?></span> <img class="theme-screenshot" src="{{ data.screenshot_url }}" alt="" /> <div class="theme-details"> <div class="rating rating-{{ Math.round( data.rating / 10 ) * 10 }}"> <span class="one"></span> <span class="two"></span> <span class="three"></span> <span class="four"></span> <span class="five"></span> <# if ( data.num_ratings ) { #> <p class="ratings">{{ data.num_ratings }}</p> <# } else { #> <p class="ratings"><?php _e( 'No ratings.' ); ?></p> <# } #> </div> <div class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></div> <div class="theme-description">{{{ data.description }}}</div> </div> </div> </div> <div class="wp-full-overlay-footer"> <a href="#" class="collapse-sidebar" title="<?php esc_attr_e( 'Collapse Sidebar' ); ?>"> <span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span> <span class="collapse-sidebar-arrow"></span> </a> <div class="theme-navigation"> <a class="previous-theme button" href="#"><?php _e( 'Previous' ); ?></a> <a class="next-theme button" href="#"><?php _e( 'Next' ); ?></a> </div> </div> </div> <div class="wp-full-overlay-main"> <iframe src="{{ data.preview_url }}" /> </div> </script> <?php include(ABSPATH . 'wp-admin/admin-footer.php');
01-wordpress-paypal
trunk/wp-admin/theme-install.php
PHP
gpl3
10,668
<?php /** * Multisite sites administration panel. * * @package WordPress * @subpackage Multisite * @since 3.0.0 */ require_once( dirname( __FILE__ ) . '/admin.php' ); wp_redirect( network_admin_url('sites.php') ); exit;
01-wordpress-paypal
trunk/wp-admin/ms-sites.php
PHP
gpl3
228
<?php /** * New User Administration Screen. * * @package WordPress * @subpackage Administration */ /** WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); if ( is_multisite() ) { if ( ! current_user_can( 'create_users' ) && ! current_user_can( 'promote_users' ) ) wp_die( __( 'Cheatin&#8217; uh?' ) ); } elseif ( ! current_user_can( 'create_users' ) ) { wp_die( __( 'Cheatin&#8217; uh?' ) ); } if ( is_multisite() ) { function admin_created_user_email( $text ) { $roles = get_editable_roles(); $role = $roles[ $_REQUEST['role'] ]; /* translators: 1: Site name, 2: site URL, 3: role */ return sprintf( __( 'Hi, You\'ve been invited to join \'%1$s\' at %2$s with the role of %3$s. If you do not want to join this site please ignore this email. This invitation will expire in a few days. Please click the following link to activate your user account: %%s' ), get_bloginfo( 'name' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ) ); } add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' ); function admin_created_user_subject( $text ) { return sprintf( __( '[%s] Your site invite' ), get_bloginfo( 'name' ) ); } } if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) { check_admin_referer( 'add-user', '_wpnonce_add-user' ); $user_details = null; if ( false !== strpos($_REQUEST[ 'email' ], '@') ) { $user_details = get_user_by('email', $_REQUEST[ 'email' ]); } else { if ( is_super_admin() ) { $user_details = get_user_by('login', $_REQUEST[ 'email' ]); } else { wp_redirect( add_query_arg( array('update' => 'enter_email'), 'user-new.php' ) ); die(); } } if ( !$user_details ) { wp_redirect( add_query_arg( array('update' => 'does_not_exist'), 'user-new.php' ) ); die(); } if ( ! current_user_can('promote_user', $user_details->ID) ) wp_die(__('Cheatin&#8217; uh?')); // Adding an existing user to this blog $new_user_email = $user_details->user_email; $redirect = 'user-new.php'; $username = $user_details->user_login; $user_id = $user_details->ID; if ( ( $username != null && !is_super_admin( $user_id ) ) && ( array_key_exists($blog_id, get_blogs_of_user($user_id)) ) ) { $redirect = add_query_arg( array('update' => 'addexisting'), 'user-new.php' ); } else { if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) ); $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' ); } else { $newuser_key = substr( md5( $user_id ), 0, 5 ); add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) ); $roles = get_editable_roles(); $role = $roles[ $_REQUEST['role'] ]; /* translators: 1: Site name, 2: site URL, 3: role, 4: activation URL */ $message = __( 'Hi, You\'ve been invited to join \'%1$s\' at %2$s with the role of %3$s. Please click the following link to confirm the invite: %4$s' ); wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), wp_specialchars_decode( get_option( 'blogname' ) ) ), sprintf( $message, get_option( 'blogname' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ), home_url( "/newbloguser/$newuser_key/" ) ) ); $redirect = add_query_arg( array('update' => 'add'), 'user-new.php' ); } } wp_redirect( $redirect ); die(); } elseif ( isset($_REQUEST['action']) && 'createuser' == $_REQUEST['action'] ) { check_admin_referer( 'create-user', '_wpnonce_create-user' ); if ( ! current_user_can('create_users') ) wp_die(__('Cheatin&#8217; uh?')); if ( ! is_multisite() ) { $user_id = edit_user(); if ( is_wp_error( $user_id ) ) { $add_user_errors = $user_id; } else { if ( current_user_can( 'list_users' ) ) $redirect = 'users.php?update=add&id=' . $user_id; else $redirect = add_query_arg( 'update', 'add', 'user-new.php' ); wp_redirect( $redirect ); die(); } } else { // Adding a new user to this site $user_details = wpmu_validate_user_signup( $_REQUEST[ 'user_login' ], $_REQUEST[ 'email' ] ); if ( is_wp_error( $user_details[ 'errors' ] ) && !empty( $user_details[ 'errors' ]->errors ) ) { $add_user_errors = $user_details[ 'errors' ]; } else { /** * Filter the user_login, also known as the username, before it is added to the site. * * @since 2.0.3 * * @param string $user_login The sanitized username. */ $new_user_login = apply_filters( 'pre_user_login', sanitize_user( wp_unslash( $_REQUEST['user_login'] ), true ) ); if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email } wpmu_signup_user( $new_user_login, $_REQUEST[ 'email' ], array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST[ 'role' ] ) ); if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { $key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $_REQUEST[ 'email' ] ) ); wpmu_activate_signup( $key ); $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' ); } else { $redirect = add_query_arg( array('update' => 'newuserconfirmation'), 'user-new.php' ); } wp_redirect( $redirect ); die(); } } } $title = __('Add New User'); $parent_file = 'users.php'; $do_both = false; if ( is_multisite() && current_user_can('promote_users') && current_user_can('create_users') ) $do_both = true; $help = '<p>' . __('To add a new user to your site, fill in the form on this screen and click the Add New User button at the bottom.') . '</p>'; if ( is_multisite() ) { $help .= '<p>' . __('Because this is a multisite installation, you may add accounts that already exist on the Network by specifying a username or email, and defining a role. For more options, such as specifying a password, you have to be a Network Administrator and use the hover link under an existing user&#8217;s name to Edit the user profile under Network Admin > All Users.') . '</p>' . '<p>' . __('New users will receive an email letting them know they&#8217;ve been added as a user for your site. This email will also contain their password. Check the box if you don&#8217;t want the user to receive a welcome email.') . '</p>'; } else { $help .= '<p>' . __('You must assign a password to the new user, which they can change after logging in. The username, however, cannot be changed.') . '</p>' . '<p>' . __('New users will receive an email letting them know they&#8217;ve been added as a user for your site. By default, this email will also contain their password. Uncheck the box if you don&#8217;t want the password to be included in the welcome email.') . '</p>'; } $help .= '<p>' . __('Remember to click the Add New User button at the bottom of this screen when you are finished.') . '</p>'; get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => $help, ) ); get_current_screen()->add_help_tab( array( 'id' => 'user-roles', 'title' => __('User Roles'), 'content' => '<p>' . __('Here is a basic overview of the different user roles and the permissions associated with each one:') . '</p>' . '<ul>' . '<li>' . __('Administrators have access to all the administration features.') . '</li>' . '<li>' . __('Editors can publish posts, manage posts as well as manage other people&#8217;s posts, etc.') . '</li>' . '<li>' . __('Authors can publish and manage their own posts, and are able to upload files.') . '</li>' . '<li>' . __('Contributors can write and manage their posts but not publish posts or upload media files.') . '</li>' . '<li>' . __('Subscribers can read comments/comment/receive newsletters, etc. but cannot create regular site content.') . '</li>' . '</ul>' ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Users_Add_New_Screen" target="_blank">Documentation on Adding New Users</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); wp_enqueue_script('wp-ajax-response'); wp_enqueue_script('user-profile'); /** * Filter whether to enable user auto-complete for non-super admins in Multisite. * * @since 3.4.0 * * @param bool $enable Whether to enable auto-complete for non-super admins. Default false. */ if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' ) && ( is_super_admin() || apply_filters( 'autocomplete_users_for_site_admins', false ) ) ) { wp_enqueue_script( 'user-suggest' ); } require_once( ABSPATH . 'wp-admin/admin-header.php' ); if ( isset($_GET['update']) ) { $messages = array(); if ( is_multisite() ) { switch ( $_GET['update'] ) { case "newuserconfirmation": $messages[] = __('Invitation email sent to new user. A confirmation link must be clicked before their account is created.'); break; case "add": $messages[] = __('Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.'); break; case "addnoconfirmation": $messages[] = __('User has been added to your site.'); break; case "addexisting": $messages[] = __('That user is already a member of this site.'); break; case "does_not_exist": $messages[] = __('The requested user does not exist.'); break; case "enter_email": $messages[] = __('Please enter a valid email address.'); break; } } else { if ( 'add' == $_GET['update'] ) $messages[] = __('User added.'); } } ?> <div class="wrap"> <h2 id="add-new-user"> <?php if ( current_user_can( 'create_users' ) ) { echo _x( 'Add New User', 'user' ); } elseif ( current_user_can( 'promote_users' ) ) { echo _x( 'Add Existing User', 'user' ); } ?> </h2> <?php if ( isset($errors) && is_wp_error( $errors ) ) : ?> <div class="error"> <ul> <?php foreach ( $errors->get_error_messages() as $err ) echo "<li>$err</li>\n"; ?> </ul> </div> <?php endif; if ( ! empty( $messages ) ) { foreach ( $messages as $msg ) echo '<div id="message" class="updated"><p>' . $msg . '</p></div>'; } ?> <?php if ( isset($add_user_errors) && is_wp_error( $add_user_errors ) ) : ?> <div class="error"> <?php foreach ( $add_user_errors->get_error_messages() as $message ) echo "<p>$message</p>"; ?> </div> <?php endif; ?> <div id="ajax-response"></div> <?php if ( is_multisite() ) { if ( $do_both ) echo '<h3 id="add-existing-user">' . __('Add Existing User') . '</h3>'; if ( !is_super_admin() ) { _e( 'Enter the email address of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ); $label = __('E-mail'); } else { _e( 'Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ); $label = __('E-mail or Username'); } ?> <?php /** * Fires inside the adduser form tag. * * @since 3.0.0 */ ?> <form action="" method="post" name="adduser" id="adduser" class="validate"<?php do_action( 'user_new_form_tag' );?>> <input name="action" type="hidden" value="adduser" /> <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?> <table class="form-table"> <tr class="form-field form-required"> <th scope="row"><label for="adduser-email"><?php echo $label; ?></label></th> <td><input name="email" type="text" id="adduser-email" class="wp-suggest-user" value="" /></td> </tr> <tr class="form-field"> <th scope="row"><label for="adduser-role"><?php _e('Role'); ?></label></th> <td><select name="role" id="adduser-role"> <?php wp_dropdown_roles( get_option('default_role') ); ?> </select> </td> </tr> <?php if ( is_super_admin() ) { ?> <tr> <th scope="row"><label for="adduser-noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th> <td><label for="adduser-noconfirmation"><input type="checkbox" name="noconfirmation" id="adduser-noconfirmation" value="1" /> <?php _e( 'Add the user without sending them a confirmation email.' ); ?></label></td> </tr> <?php } ?> </table> <?php /** * Fires at the end of the new user form. * * Passes a contextual string to make both types of new user forms * uniquely targetable. Contexts are 'add-existing-user' (Multisite), * and 'add-new-user' (single site and network admin). * * @since 3.7.0 * * @param string $type A contextual string specifying which type of new user form the hook follows. */ do_action( 'user_new_form', 'add-existing-user' ); ?> <?php submit_button( __( 'Add Existing User '), 'primary', 'adduser', true, array( 'id' => 'addusersub' ) ); ?> </form> <?php } // is_multisite() if ( current_user_can( 'create_users') ) { if ( $do_both ) echo '<h3 id="create-new-user">' . __( 'Add New User' ) . '</h3>'; ?> <p><?php _e('Create a brand new user and add them to this site.'); ?></p> <?php /** This action is documented in wp-admin/user-new.php */ ?> <form action="" method="post" name="createuser" id="createuser" class="validate"<?php do_action( 'user_new_form_tag' );?>> <input name="action" type="hidden" value="createuser" /> <?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ); ?> <?php // Load up the passed data, else set to a default. foreach ( array( 'user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname', 'email' => 'email', 'url' => 'uri', 'role' => 'role', 'send_password' => 'send_password', 'noconfirmation' => 'ignore_pass' ) as $post_field => $var ) { $var = "new_user_$var"; if( isset( $_POST['createuser'] ) ) { if ( ! isset($$var) ) $$var = isset( $_POST[$post_field] ) ? wp_unslash( $_POST[$post_field] ) : ''; } else { $$var = false; } } ?> <table class="form-table"> <tr class="form-field form-required"> <th scope="row"><label for="user_login"><?php _e('Username'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th> <td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr($new_user_login); ?>" aria-required="true" /></td> </tr> <tr class="form-field form-required"> <th scope="row"><label for="email"><?php _e('E-mail'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th> <td><input name="email" type="text" id="email" value="<?php echo esc_attr($new_user_email); ?>" /></td> </tr> <?php if ( !is_multisite() ) { ?> <tr class="form-field"> <th scope="row"><label for="first_name"><?php _e('First Name') ?> </label></th> <td><input name="first_name" type="text" id="first_name" value="<?php echo esc_attr($new_user_firstname); ?>" /></td> </tr> <tr class="form-field"> <th scope="row"><label for="last_name"><?php _e('Last Name') ?> </label></th> <td><input name="last_name" type="text" id="last_name" value="<?php echo esc_attr($new_user_lastname); ?>" /></td> </tr> <tr class="form-field"> <th scope="row"><label for="url"><?php _e('Website') ?></label></th> <td><input name="url" type="text" id="url" class="code" value="<?php echo esc_attr($new_user_uri); ?>" /></td> </tr> <?php /** * Filter the display of the password fields. * * @since 1.5.1 * * @param bool $show Whether to show the password fields. Default true. */ if ( apply_filters( 'show_password_fields', true ) ) : ?> <tr class="form-field form-required"> <th scope="row"><label for="pass1"><?php _e('Password'); ?> <span class="description"><?php /* translators: password input field */_e('(required)'); ?></span></label></th> <td> <input class="hidden" value=" " /><!-- #24364 workaround --> <input name="pass1" type="password" id="pass1" autocomplete="off" /> </td> </tr> <tr class="form-field form-required"> <th scope="row"><label for="pass2"><?php _e('Repeat Password'); ?> <span class="description"><?php /* translators: password input field */_e('(required)'); ?></span></label></th> <td> <input name="pass2" type="password" id="pass2" autocomplete="off" /> <br /> <div id="pass-strength-result"><?php _e('Strength indicator'); ?></div> <p class="description indicator-hint"><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ &amp; ).'); ?></p> </td> </tr> <tr> <th scope="row"><label for="send_password"><?php _e('Send Password?') ?></label></th> <td><label for="send_password"><input type="checkbox" name="send_password" id="send_password" value="1" <?php checked( $new_user_send_password ); ?> /> <?php _e('Send this password to the new user by email.'); ?></label></td> </tr> <?php endif; ?> <?php } // !is_multisite ?> <tr class="form-field"> <th scope="row"><label for="role"><?php _e('Role'); ?></label></th> <td><select name="role" id="role"> <?php if ( !$new_user_role ) $new_user_role = !empty($current_role) ? $current_role : get_option('default_role'); wp_dropdown_roles($new_user_role); ?> </select> </td> </tr> <?php if ( is_multisite() && is_super_admin() ) { ?> <tr> <th scope="row"><label for="noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th> <td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked( $new_user_ignore_pass ); ?> /> <?php _e( 'Add the user without sending them a confirmation email.' ); ?></label></td> </tr> <?php } ?> </table> <?php /** This action is documented in wp-admin/user-new.php */ do_action( 'user_new_form', 'add-new-user' ); ?> <?php submit_button( __( 'Add New User '), 'primary', 'createuser', true, array( 'id' => 'createusersub' ) ); ?> </form> <?php } // current_user_can('create_users') ?> </div> <?php include( ABSPATH . 'wp-admin/admin-footer.php' );
01-wordpress-paypal
trunk/wp-admin/user-new.php
PHP
gpl3
18,161
/* global _wpCustomizeWidgetsSettings */ (function( wp, $ ){ if ( ! wp || ! wp.customize ) { return; } // Set up our namespace... var api = wp.customize, l10n, OldPreviewer; api.Widgets = api.Widgets || {}; // Link settings api.Widgets.data = _wpCustomizeWidgetsSettings || {}; l10n = api.Widgets.data.l10n; delete api.Widgets.data.l10n; /** * wp.customize.Widgets.WidgetModel * * A single widget model. * * @constructor * @augments Backbone.Model */ api.Widgets.WidgetModel = Backbone.Model.extend({ id: null, temp_id: null, classname: null, control_tpl: null, description: null, is_disabled: null, is_multi: null, multi_number: null, name: null, id_base: null, transport: 'refresh', params: [], width: null, height: null, search_matched: true }); /** * wp.customize.Widgets.WidgetCollection * * Collection for widget models. * * @constructor * @augments Backbone.Model */ api.Widgets.WidgetCollection = Backbone.Collection.extend({ model: api.Widgets.WidgetModel, // Controls searching on the current widget collection // and triggers an update event doSearch: function( value ) { // Don't do anything if we've already done this search // Useful because the search handler fires multiple times per keystroke if ( this.terms === value ) { return; } // Updates terms with the value passed this.terms = value; // If we have terms, run a search... if ( this.terms.length > 0 ) { this.search( this.terms ); } // If search is blank, show all themes // Useful for resetting the views when you clean the input if ( this.terms === '' ) { this.each( function ( widget ) { widget.set( 'search_matched', true ); } ); } }, // Performs a search within the collection // @uses RegExp search: function( term ) { var match, haystack; // Escape the term string for RegExp meta characters term = term.replace( /[-\/\\^$*+?.()|[\]{}]/g, '\\$&' ); // Consider spaces as word delimiters and match the whole string // so matching terms can be combined term = term.replace( / /g, ')(?=.*' ); match = new RegExp( '^(?=.*' + term + ').+', 'i' ); this.each( function ( data ) { haystack = [ data.get( 'name' ), data.get( 'id' ), data.get( 'description' ) ].join( ' ' ); data.set( 'search_matched', match.test( haystack ) ); } ); } }); api.Widgets.availableWidgets = new api.Widgets.WidgetCollection( api.Widgets.data.availableWidgets ); /** * wp.customize.Widgets.SidebarModel * * A single sidebar model. * * @constructor * @augments Backbone.Model */ api.Widgets.SidebarModel = Backbone.Model.extend({ after_title: null, after_widget: null, before_title: null, before_widget: null, 'class': null, description: null, id: null, name: null, is_rendered: false }); /** * wp.customize.Widgets.SidebarCollection * * Collection for sidebar models. * * @constructor * @augments Backbone.Collection */ api.Widgets.SidebarCollection = Backbone.Collection.extend({ model: api.Widgets.SidebarModel }); api.Widgets.registeredSidebars = new api.Widgets.SidebarCollection( api.Widgets.data.registeredSidebars ); /** * wp.customize.Widgets.AvailableWidgetsPanelView * * View class for the available widgets panel. * * @constructor * @augments wp.Backbone.View * @augments Backbone.View */ api.Widgets.AvailableWidgetsPanelView = wp.Backbone.View.extend({ el: '#available-widgets', events: { 'input #widgets-search': 'search', 'keyup #widgets-search': 'search', 'change #widgets-search': 'search', 'search #widgets-search': 'search', 'focus .widget-tpl' : 'focus', 'click .widget-tpl' : '_submit', 'keypress .widget-tpl' : '_submit', 'keydown' : 'keyboardAccessible' }, // Cache current selected widget selected: null, // Cache sidebar control which has opened panel currentSidebarControl: null, $search: null, initialize: function() { var self = this; this.$search = $( '#widgets-search' ); _.bindAll( this, 'close' ); this.listenTo( this.collection, 'change', this.updateList ); this.updateList(); // If the available widgets panel is open and the customize controls are // interacted with (i.e. available widgets panel is blurred) then close the // available widgets panel. $( '#customize-controls' ).on( 'click keydown', function( e ) { var isAddNewBtn = $( e.target ).is( '.add-new-widget, .add-new-widget *' ); if ( $( 'body' ).hasClass( 'adding-widget' ) && ! isAddNewBtn ) { self.close(); } } ); // Close the panel if the URL in the preview changes api.Widgets.Previewer.bind( 'url', this.close ); }, // Performs a search and handles selected widget search: function( event ) { var firstVisible; this.collection.doSearch( event.target.value ); // Remove a widget from being selected if it is no longer visible if ( this.selected && ! this.selected.is( ':visible' ) ) { this.selected.removeClass( 'selected' ); this.selected = null; } // If a widget was selected but the filter value has been cleared out, clear selection if ( this.selected && ! event.target.value ) { this.selected.removeClass( 'selected' ); this.selected = null; } // If a filter has been entered and a widget hasn't been selected, select the first one shown if ( ! this.selected && event.target.value ) { firstVisible = this.$el.find( '> .widget-tpl:visible:first' ); if ( firstVisible.length ) { this.select( firstVisible ); } } }, // Changes visibility of available widgets updateList: function() { this.collection.each( function( widget ) { var widgetTpl = $( '#widget-tpl-' + widget.id ); widgetTpl.toggle( widget.get( 'search_matched' ) && ! widget.get( 'is_disabled' ) ); if ( widget.get( 'is_disabled' ) && widgetTpl.is( this.selected ) ) { this.selected = null; } } ); }, // Highlights a widget select: function( widgetTpl ) { this.selected = $( widgetTpl ); this.selected.siblings( '.widget-tpl' ).removeClass( 'selected' ); this.selected.addClass( 'selected' ); }, // Highlights a widget on focus focus: function( event ) { this.select( $( event.currentTarget ) ); }, // Submit handler for keypress and click on widget _submit: function( event ) { // Only proceed with keypress if it is Enter or Spacebar if ( event.type === 'keypress' && ( event.which !== 13 && event.which !== 32 ) ) { return; } this.submit( $( event.currentTarget ) ); }, // Adds a selected widget to the sidebar submit: function( widgetTpl ) { var widgetId, widget; if ( ! widgetTpl ) { widgetTpl = this.selected; } if ( ! widgetTpl || ! this.currentSidebarControl ) { return; } this.select( widgetTpl ); widgetId = $( this.selected ).data( 'widget-id' ); widget = this.collection.findWhere( { id: widgetId } ); if ( ! widget ) { return; } this.currentSidebarControl.addWidget( widget.get( 'id_base' ) ); this.close(); }, // Opens the panel open: function( sidebarControl ) { this.currentSidebarControl = sidebarControl; // Wide widget controls appear over the preview, and so they need to be collapsed when the panel opens _( this.currentSidebarControl.getWidgetFormControls() ).each( function( control ) { if ( control.params.is_wide ) { control.collapseForm(); } } ); $( 'body' ).addClass( 'adding-widget' ); this.$el.find( '.selected' ).removeClass( 'selected' ); // Reset search this.collection.doSearch( '' ); this.$search.focus(); }, // Closes the panel close: function( options ) { options = options || {}; if ( options.returnFocus && this.currentSidebarControl ) { this.currentSidebarControl.container.find( '.add-new-widget' ).focus(); } this.currentSidebarControl = null; this.selected = null; $( 'body' ).removeClass( 'adding-widget' ); this.$search.val( '' ); }, // Add keyboard accessiblity to the panel keyboardAccessible: function( event ) { var isEnter = ( event.which === 13 ), isEsc = ( event.which === 27 ), isDown = ( event.which === 40 ), isUp = ( event.which === 38 ), selected = null, firstVisible = this.$el.find( '> .widget-tpl:visible:first' ), lastVisible = this.$el.find( '> .widget-tpl:visible:last' ), isSearchFocused = $( event.target ).is( this.$search ); if ( isDown || isUp ) { if ( isDown ) { if ( isSearchFocused ) { selected = firstVisible; } else if ( this.selected && this.selected.nextAll( '.widget-tpl:visible' ).length !== 0 ) { selected = this.selected.nextAll( '.widget-tpl:visible:first' ); } } else if ( isUp ) { if ( isSearchFocused ) { selected = lastVisible; } else if ( this.selected && this.selected.prevAll( '.widget-tpl:visible' ).length !== 0 ) { selected = this.selected.prevAll( '.widget-tpl:visible:first' ); } } this.select( selected ); if ( selected ) { selected.focus(); } else { this.$search.focus(); } return; } // If enter pressed but nothing entered, don't do anything if ( isEnter && ! this.$search.val() ) { return; } if ( isEnter ) { this.submit(); } else if ( isEsc ) { this.close( { returnFocus: true } ); } } }); /** * Handlers for the widget-synced event, organized by widget ID base. * Other widgets may provide their own update handlers by adding * listeners for the widget-synced event. */ api.Widgets.formSyncHandlers = { /** * @param {jQuery.Event} e * @param {jQuery} widget * @param {String} newForm */ rss: function( e, widget, newForm ) { var oldWidgetError = widget.find( '.widget-error:first' ), newWidgetError = $( '<div>' + newForm + '</div>' ).find( '.widget-error:first' ); if ( oldWidgetError.length && newWidgetError.length ) { oldWidgetError.replaceWith( newWidgetError ); } else if ( oldWidgetError.length ) { oldWidgetError.remove(); } else if ( newWidgetError.length ) { widget.find( '.widget-content:first' ).prepend( newWidgetError ); } } }; /** * wp.customize.Widgets.WidgetControl * * Customizer control for widgets. * Note that 'widget_form' must match the WP_Widget_Form_Customize_Control::$type * * @constructor * @augments wp.customize.Control */ api.Widgets.WidgetControl = api.Control.extend({ /** * Set up the control */ ready: function() { this._setupModel(); this._setupWideWidget(); this._setupControlToggle(); this._setupWidgetTitle(); this._setupReorderUI(); this._setupHighlightEffects(); this._setupUpdateUI(); this._setupRemoveUI(); }, /** * Handle changes to the setting */ _setupModel: function() { var self = this, rememberSavedWidgetId; api.Widgets.savedWidgetIds = api.Widgets.savedWidgetIds || []; // Remember saved widgets so we know which to trash (move to inactive widgets sidebar) rememberSavedWidgetId = function() { api.Widgets.savedWidgetIds[self.params.widget_id] = true; }; api.bind( 'ready', rememberSavedWidgetId ); api.bind( 'saved', rememberSavedWidgetId ); this._updateCount = 0; this.isWidgetUpdating = false; this.liveUpdateMode = true; // Update widget whenever model changes this.setting.bind( function( to, from ) { if ( ! _( from ).isEqual( to ) && ! self.isWidgetUpdating ) { self.updateWidget( { instance: to } ); } } ); }, /** * Add special behaviors for wide widget controls */ _setupWideWidget: function() { var self = this, $widgetInside, $widgetForm, $customizeSidebar, $themeControlsContainer, positionWidget; if ( ! this.params.is_wide ) { return; } $widgetInside = this.container.find( '.widget-inside' ); $widgetForm = $widgetInside.find( '> .form' ); $customizeSidebar = $( '.wp-full-overlay-sidebar-content:first' ); this.container.addClass( 'wide-widget-control' ); this.container.find( '.widget-content:first' ).css( { 'max-width': this.params.width, 'min-height': this.params.height } ); /** * Keep the widget-inside positioned so the top of fixed-positioned * element is at the same top position as the widget-top. When the * widget-top is scrolled out of view, keep the widget-top in view; * likewise, don't allow the widget to drop off the bottom of the window. * If a widget is too tall to fit in the window, don't let the height * exceed the window height so that the contents of the widget control * will become scrollable (overflow:auto). */ positionWidget = function() { var offsetTop = self.container.offset().top, windowHeight = $( window ).height(), formHeight = $widgetForm.outerHeight(), top; $widgetInside.css( 'max-height', windowHeight ); top = Math.max( 0, // prevent top from going off screen Math.min( Math.max( offsetTop, 0 ), // distance widget in panel is from top of screen windowHeight - formHeight // flush up against bottom of screen ) ); $widgetInside.css( 'top', top ); }; $themeControlsContainer = $( '#customize-theme-controls' ); this.container.on( 'expand', function() { positionWidget(); $customizeSidebar.on( 'scroll', positionWidget ); $( window ).on( 'resize', positionWidget ); $themeControlsContainer.on( 'expanded collapsed', positionWidget ); } ); this.container.on( 'collapsed', function() { $customizeSidebar.off( 'scroll', positionWidget ); $( window ).off( 'resize', positionWidget ); $themeControlsContainer.off( 'expanded collapsed', positionWidget ); } ); // Reposition whenever a sidebar's widgets are changed api.each( function( setting ) { if ( 0 === setting.id.indexOf( 'sidebars_widgets[' ) ) { setting.bind( function() { if ( self.container.hasClass( 'expanded' ) ) { positionWidget(); } } ); } } ); }, /** * Show/hide the control when clicking on the form title, when clicking * the close button */ _setupControlToggle: function() { var self = this, $closeBtn; this.container.find( '.widget-top' ).on( 'click', function( e ) { e.preventDefault(); var sidebarWidgetsControl = self.getSidebarWidgetsControl(); if ( sidebarWidgetsControl.isReordering ) { return; } self.toggleForm(); } ); $closeBtn = this.container.find( '.widget-control-close' ); $closeBtn.on( 'click', function( e ) { e.preventDefault(); self.collapseForm(); self.container.find( '.widget-top .widget-action:first' ).focus(); // keyboard accessibility } ); }, /** * Update the title of the form if a title field is entered */ _setupWidgetTitle: function() { var self = this, updateTitle; updateTitle = function() { var title = self.setting().title, inWidgetTitle = self.container.find( '.in-widget-title' ); if ( title ) { inWidgetTitle.text( ': ' + title ); } else { inWidgetTitle.text( '' ); } }; this.setting.bind( updateTitle ); updateTitle(); }, /** * Set up the widget-reorder-nav */ _setupReorderUI: function() { var self = this, selectSidebarItem, $moveWidgetArea, $reorderNav, updateAvailableSidebars; /** * select the provided sidebar list item in the move widget area * * @param {jQuery} li */ selectSidebarItem = function( li ) { li.siblings( '.selected' ).removeClass( 'selected' ); li.addClass( 'selected' ); var isSelfSidebar = ( li.data( 'id' ) === self.params.sidebar_id ); self.container.find( '.move-widget-btn' ).prop( 'disabled', isSelfSidebar ); }; /** * Add the widget reordering elements to the widget control */ this.container.find( '.widget-title-action' ).after( $( api.Widgets.data.tpl.widgetReorderNav ) ); $moveWidgetArea = $( _.template( api.Widgets.data.tpl.moveWidgetArea, { sidebars: _( api.Widgets.registeredSidebars.toArray() ).pluck( 'attributes' ) } ) ); this.container.find( '.widget-top' ).after( $moveWidgetArea ); /** * Update available sidebars when their rendered state changes */ updateAvailableSidebars = function() { var $sidebarItems = $moveWidgetArea.find( 'li' ), selfSidebarItem; selfSidebarItem = $sidebarItems.filter( function(){ return $( this ).data( 'id' ) === self.params.sidebar_id; } ); $sidebarItems.each( function() { var li = $( this ), sidebarId, sidebar; sidebarId = li.data( 'id' ); sidebar = api.Widgets.registeredSidebars.get( sidebarId ); li.toggle( sidebar.get( 'is_rendered' ) ); if ( li.hasClass( 'selected' ) && ! sidebar.get( 'is_rendered' ) ) { selectSidebarItem( selfSidebarItem ); } } ); }; updateAvailableSidebars(); api.Widgets.registeredSidebars.on( 'change:is_rendered', updateAvailableSidebars ); /** * Handle clicks for up/down/move on the reorder nav */ $reorderNav = this.container.find( '.widget-reorder-nav' ); $reorderNav.find( '.move-widget, .move-widget-down, .move-widget-up' ).on( 'click keypress', function( event ) { if ( event.type === 'keypress' && ( event.which !== 13 && event.which !== 32 ) ) { return; } $( this ).focus(); if ( $( this ).is( '.move-widget' ) ) { self.toggleWidgetMoveArea(); } else { var isMoveDown = $( this ).is( '.move-widget-down' ), isMoveUp = $( this ).is( '.move-widget-up' ), i = self.getWidgetSidebarPosition(); if ( ( isMoveUp && i === 0 ) || ( isMoveDown && i === self.getSidebarWidgetsControl().setting().length - 1 ) ) { return; } if ( isMoveUp ) { self.moveUp(); } else { self.moveDown(); } $( this ).focus(); // re-focus after the container was moved } } ); /** * Handle selecting a sidebar to move to */ this.container.find( '.widget-area-select' ).on( 'click keypress', 'li', function( e ) { if ( event.type === 'keypress' && ( event.which !== 13 && event.which !== 32 ) ) { return; } e.preventDefault(); selectSidebarItem( $( this ) ); } ); /** * Move widget to another sidebar */ this.container.find( '.move-widget-btn' ).click( function() { self.getSidebarWidgetsControl().toggleReordering( false ); var oldSidebarId = self.params.sidebar_id, newSidebarId = self.container.find( '.widget-area-select li.selected' ).data( 'id' ), oldSidebarWidgetsSetting, newSidebarWidgetsSetting, oldSidebarWidgetIds, newSidebarWidgetIds, i; oldSidebarWidgetsSetting = api( 'sidebars_widgets[' + oldSidebarId + ']' ); newSidebarWidgetsSetting = api( 'sidebars_widgets[' + newSidebarId + ']' ); oldSidebarWidgetIds = Array.prototype.slice.call( oldSidebarWidgetsSetting() ); newSidebarWidgetIds = Array.prototype.slice.call( newSidebarWidgetsSetting() ); i = self.getWidgetSidebarPosition(); oldSidebarWidgetIds.splice( i, 1 ); newSidebarWidgetIds.push( self.params.widget_id ); oldSidebarWidgetsSetting( oldSidebarWidgetIds ); newSidebarWidgetsSetting( newSidebarWidgetIds ); self.focus(); } ); }, /** * Highlight widgets in preview when interacted with in the customizer */ _setupHighlightEffects: function() { var self = this; // Highlight whenever hovering or clicking over the form this.container.on( 'mouseenter click', function() { self.setting.previewer.send( 'highlight-widget', self.params.widget_id ); } ); // Highlight when the setting is updated this.setting.bind( function() { self.setting.previewer.send( 'highlight-widget', self.params.widget_id ); } ); }, /** * Set up event handlers for widget updating */ _setupUpdateUI: function() { var self = this, $widgetRoot, $widgetContent, $saveBtn, updateWidgetDebounced, formSyncHandler; $widgetRoot = this.container.find( '.widget:first' ); $widgetContent = $widgetRoot.find( '.widget-content:first' ); // Configure update button $saveBtn = this.container.find( '.widget-control-save' ); $saveBtn.val( l10n.saveBtnLabel ); $saveBtn.attr( 'title', l10n.saveBtnTooltip ); $saveBtn.removeClass( 'button-primary' ).addClass( 'button-secondary' ); $saveBtn.on( 'click', function( e ) { e.preventDefault(); self.updateWidget( { disable_form: true } ); // @todo disable_form is unused? } ); updateWidgetDebounced = _.debounce( function() { self.updateWidget(); }, 250 ); // Trigger widget form update when hitting Enter within an input $widgetContent.on( 'keydown', 'input', function( e ) { if ( 13 === e.which ) { // Enter e.preventDefault(); self.updateWidget( { ignoreActiveElement: true } ); } } ); // Handle widgets that support live previews $widgetContent.on( 'change input propertychange', ':input', function( e ) { if ( self.liveUpdateMode ) { if ( e.type === 'change' ) { self.updateWidget(); } else if ( this.checkValidity && this.checkValidity() ) { updateWidgetDebounced(); } } } ); // Remove loading indicators when the setting is saved and the preview updates this.setting.previewer.channel.bind( 'synced', function() { self.container.removeClass( 'previewer-loading' ); } ); api.Widgets.Previewer.bind( 'widget-updated', function( updatedWidgetId ) { if ( updatedWidgetId === self.params.widget_id ) { self.container.removeClass( 'previewer-loading' ); } } ); // Update widget control to indicate whether it is currently rendered api.Widgets.Previewer.bind( 'rendered-widgets', function( renderedWidgets ) { var isRendered = !! renderedWidgets[self.params.widget_id]; self.container.toggleClass( 'widget-rendered', isRendered ); } ); formSyncHandler = api.Widgets.formSyncHandlers[ this.params.widget_id_base ]; if ( formSyncHandler ) { $( document ).on( 'widget-synced', function( e, widget ) { if ( $widgetRoot.is( widget ) ) { formSyncHandler.apply( document, arguments ); } } ); } }, /** * Set up event handlers for widget removal */ _setupRemoveUI: function() { var self = this, $removeBtn, replaceDeleteWithRemove; // Configure remove button $removeBtn = this.container.find( 'a.widget-control-remove' ); $removeBtn.on( 'click', function( e ) { e.preventDefault(); // Find an adjacent element to add focus to when this widget goes away var $adjacentFocusTarget; if ( self.container.next().is( '.customize-control-widget_form' ) ) { $adjacentFocusTarget = self.container.next().find( '.widget-action:first' ); } else if ( self.container.prev().is( '.customize-control-widget_form' ) ) { $adjacentFocusTarget = self.container.prev().find( '.widget-action:first' ); } else { $adjacentFocusTarget = self.container.next( '.customize-control-sidebar_widgets' ).find( '.add-new-widget:first' ); } self.container.slideUp( function() { var sidebarsWidgetsControl = api.Widgets.getSidebarWidgetControlContainingWidget( self.params.widget_id ), sidebarWidgetIds, i; if ( ! sidebarsWidgetsControl ) { return; } sidebarWidgetIds = sidebarsWidgetsControl.setting().slice(); i = _.indexOf( sidebarWidgetIds, self.params.widget_id ); if ( -1 === i ) { return; } sidebarWidgetIds.splice( i, 1 ); sidebarsWidgetsControl.setting( sidebarWidgetIds ); $adjacentFocusTarget.focus(); // keyboard accessibility } ); } ); replaceDeleteWithRemove = function() { $removeBtn.text( l10n.removeBtnLabel ); // wp_widget_control() outputs the link as "Delete" $removeBtn.attr( 'title', l10n.removeBtnTooltip ); }; if ( this.params.is_new ) { api.bind( 'saved', replaceDeleteWithRemove ); } else { replaceDeleteWithRemove(); } }, /** * Find all inputs in a widget container that should be considered when * comparing the loaded form with the sanitized form, whose fields will * be aligned to copy the sanitized over. The elements returned by this * are passed into this._getInputsSignature(), and they are iterated * over when copying sanitized values over to the the form loaded. * * @param {jQuery} container element in which to look for inputs * @returns {jQuery} inputs * @private */ _getInputs: function( container ) { return $( container ).find( ':input[name]' ); }, /** * Iterate over supplied inputs and create a signature string for all of them together. * This string can be used to compare whether or not the form has all of the same fields. * * @param {jQuery} inputs * @returns {string} * @private */ _getInputsSignature: function( inputs ) { var inputsSignatures = _( inputs ).map( function( input ) { var $input = $( input ), signatureParts; if ( $input.is( ':checkbox, :radio' ) ) { signatureParts = [ $input.attr( 'id' ), $input.attr( 'name' ), $input.prop( 'value' ) ]; } else { signatureParts = [ $input.attr( 'id' ), $input.attr( 'name' ) ]; } return signatureParts.join( ',' ); } ); return inputsSignatures.join( ';' ); }, /** * Get the property that represents the state of an input. * * @param {jQuery|DOMElement} input * @returns {string} * @private */ _getInputStatePropertyName: function( input ) { var $input = $( input ); if ( $input.is( ':radio, :checkbox' ) ) { return 'checked'; } else { return 'value'; } }, /*********************************************************************** * Begin public API methods **********************************************************************/ /** * @return {wp.customize.controlConstructor.sidebar_widgets[]} */ getSidebarWidgetsControl: function() { var settingId, sidebarWidgetsControl; settingId = 'sidebars_widgets[' + this.params.sidebar_id + ']'; sidebarWidgetsControl = api.control( settingId ); if ( ! sidebarWidgetsControl ) { return; } return sidebarWidgetsControl; }, /** * Submit the widget form via Ajax and get back the updated instance, * along with the new widget control form to render. * * @param {object} [args] * @param {Object|null} [args.instance=null] When the model changes, the instance is sent here; otherwise, the inputs from the form are used * @param {Function|null} [args.complete=null] Function which is called when the request finishes. Context is bound to the control. First argument is any error. Following arguments are for success. * @param {Boolean} [args.ignoreActiveElement=false] Whether or not updating a field will be deferred if focus is still on the element. */ updateWidget: function( args ) { var self = this, instanceOverride, completeCallback, $widgetRoot, $widgetContent, updateNumber, params, data, $inputs, processing, jqxhr, isChanged; args = $.extend( { instance: null, complete: null, ignoreActiveElement: false }, args ); instanceOverride = args.instance; completeCallback = args.complete; this._updateCount += 1; updateNumber = this._updateCount; $widgetRoot = this.container.find( '.widget:first' ); $widgetContent = $widgetRoot.find( '.widget-content:first' ); // Remove a previous error message $widgetContent.find( '.widget-error' ).remove(); this.container.addClass( 'widget-form-loading' ); this.container.addClass( 'previewer-loading' ); processing = api.state( 'processing' ); processing( processing() + 1 ); if ( ! this.liveUpdateMode ) { this.container.addClass( 'widget-form-disabled' ); } params = {}; params.action = 'update-widget'; params.wp_customize = 'on'; params.nonce = api.Widgets.data.nonce; params.theme = api.settings.theme.stylesheet; data = $.param( params ); $inputs = this._getInputs( $widgetContent ); // Store the value we're submitting in data so that when the response comes back, // we know if it got sanitized; if there is no difference in the sanitized value, // then we do not need to touch the UI and mess up the user's ongoing editing. $inputs.each( function() { var input = $( this ), property = self._getInputStatePropertyName( this ); input.data( 'state' + updateNumber, input.prop( property ) ); } ); if ( instanceOverride ) { data += '&' + $.param( { 'sanitized_widget_setting': JSON.stringify( instanceOverride ) } ); } else { data += '&' + $inputs.serialize(); } data += '&' + $widgetContent.find( '~ :input' ).serialize(); jqxhr = $.post( wp.ajax.settings.url, data ); jqxhr.done( function( r ) { var message, sanitizedForm, $sanitizedInputs, hasSameInputsInResponse, isLiveUpdateAborted = false; // Check if the user is logged out. if ( '0' === r ) { api.Widgets.Previewer.preview.iframe.hide(); api.Widgets.Previewer.login().done( function() { self.updateWidget( args ); api.Widgets.Previewer.preview.iframe.show(); } ); return; } // Check for cheaters. if ( '-1' === r ) { api.Widgets.Previewer.cheatin(); return; } if ( r.success ) { sanitizedForm = $( '<div>' + r.data.form + '</div>' ); $sanitizedInputs = self._getInputs( sanitizedForm ); hasSameInputsInResponse = self._getInputsSignature( $inputs ) === self._getInputsSignature( $sanitizedInputs ); // Restore live update mode if sanitized fields are now aligned with the existing fields if ( hasSameInputsInResponse && ! self.liveUpdateMode ) { self.liveUpdateMode = true; self.container.removeClass( 'widget-form-disabled' ); self.container.find( 'input[name="savewidget"]' ).hide(); } // Sync sanitized field states to existing fields if they are aligned if ( hasSameInputsInResponse && self.liveUpdateMode ) { $inputs.each( function( i ) { var $input = $( this ), $sanitizedInput = $( $sanitizedInputs[i] ), property = self._getInputStatePropertyName( this ), submittedState, sanitizedState, canUpdateState; submittedState = $input.data( 'state' + updateNumber ); sanitizedState = $sanitizedInput.prop( property ); $input.data( 'sanitized', sanitizedState ); canUpdateState = ( submittedState !== sanitizedState && ( args.ignoreActiveElement || ! $input.is( document.activeElement ) ) ); if ( canUpdateState ) { $input.prop( property, sanitizedState ); } } ); $( document ).trigger( 'widget-synced', [ $widgetRoot, r.data.form ] ); // Otherwise, if sanitized fields are not aligned with existing fields, disable live update mode if enabled } else if ( self.liveUpdateMode ) { self.liveUpdateMode = false; self.container.find( 'input[name="savewidget"]' ).show(); isLiveUpdateAborted = true; // Otherwise, replace existing form with the sanitized form } else { $widgetContent.html( r.data.form ); self.container.removeClass( 'widget-form-disabled' ); $( document ).trigger( 'widget-updated', [ $widgetRoot ] ); } /** * If the old instance is identical to the new one, there is nothing new * needing to be rendered, and so we can preempt the event for the * preview finishing loading. */ isChanged = ! isLiveUpdateAborted && ! _( self.setting() ).isEqual( r.data.instance ); if ( isChanged ) { self.isWidgetUpdating = true; // suppress triggering another updateWidget self.setting( r.data.instance ); self.isWidgetUpdating = false; } else { // no change was made, so stop the spinner now instead of when the preview would updates self.container.removeClass( 'previewer-loading' ); } if ( completeCallback ) { completeCallback.call( self, null, { noChange: ! isChanged, ajaxFinished: true } ); } } else { // General error message message = l10n.error; if ( r.data && r.data.message ) { message = r.data.message; } if ( completeCallback ) { completeCallback.call( self, message ); } else { $widgetContent.prepend( '<p class="widget-error"><strong>' + message + '</strong></p>' ); } } } ); jqxhr.fail( function( jqXHR, textStatus ) { if ( completeCallback ) { completeCallback.call( self, textStatus ); } } ); jqxhr.always( function() { self.container.removeClass( 'widget-form-loading' ); $inputs.each( function() { $( this ).removeData( 'state' + updateNumber ); } ); processing( processing() - 1 ); } ); }, /** * Expand the accordion section containing a control */ expandControlSection: function() { var $section = this.container.closest( '.accordion-section' ); if ( ! $section.hasClass( 'open' ) ) { $section.find( '.accordion-section-title:first' ).trigger( 'click' ); } }, /** * Expand the widget form control */ expandForm: function() { this.toggleForm( true ); }, /** * Collapse the widget form control */ collapseForm: function() { this.toggleForm( false ); }, /** * Expand or collapse the widget control * * @param {boolean|undefined} [showOrHide] If not supplied, will be inverse of current visibility */ toggleForm: function( showOrHide ) { var self = this, $widget, $inside, complete; $widget = this.container.find( 'div.widget:first' ); $inside = $widget.find( '.widget-inside:first' ); if ( typeof showOrHide === 'undefined' ) { showOrHide = ! $inside.is( ':visible' ); } // Already expanded or collapsed, so noop if ( $inside.is( ':visible' ) === showOrHide ) { return; } if ( showOrHide ) { // Close all other widget controls before expanding this one api.control.each( function( otherControl ) { if ( self.params.type === otherControl.params.type && self !== otherControl ) { otherControl.collapseForm(); } } ); complete = function() { self.container.removeClass( 'expanding' ); self.container.addClass( 'expanded' ); self.container.trigger( 'expanded' ); }; if ( self.params.is_wide ) { $inside.fadeIn( 'fast', complete ); } else { $inside.slideDown( 'fast', complete ); } self.container.trigger( 'expand' ); self.container.addClass( 'expanding' ); } else { complete = function() { self.container.removeClass( 'collapsing' ); self.container.removeClass( 'expanded' ); self.container.trigger( 'collapsed' ); }; self.container.trigger( 'collapse' ); self.container.addClass( 'collapsing' ); if ( self.params.is_wide ) { $inside.fadeOut( 'fast', complete ); } else { $inside.slideUp( 'fast', function() { $widget.css( { width:'', margin:'' } ); complete(); } ); } } }, /** * Expand the containing sidebar section, expand the form, and focus on * the first input in the control */ focus: function() { this.expandControlSection(); this.expandForm(); this.container.find( '.widget-content :focusable:first' ).focus(); }, /** * Get the position (index) of the widget in the containing sidebar * * @returns {Number} */ getWidgetSidebarPosition: function() { var sidebarWidgetIds, position; sidebarWidgetIds = this.getSidebarWidgetsControl().setting(); position = _.indexOf( sidebarWidgetIds, this.params.widget_id ); if ( position === -1 ) { return; } return position; }, /** * Move widget up one in the sidebar */ moveUp: function() { this._moveWidgetByOne( -1 ); }, /** * Move widget up one in the sidebar */ moveDown: function() { this._moveWidgetByOne( 1 ); }, /** * @private * * @param {Number} offset 1|-1 */ _moveWidgetByOne: function( offset ) { var i, sidebarWidgetsSetting, sidebarWidgetIds, adjacentWidgetId; i = this.getWidgetSidebarPosition(); sidebarWidgetsSetting = this.getSidebarWidgetsControl().setting; sidebarWidgetIds = Array.prototype.slice.call( sidebarWidgetsSetting() ); // clone adjacentWidgetId = sidebarWidgetIds[i + offset]; sidebarWidgetIds[i + offset] = this.params.widget_id; sidebarWidgetIds[i] = adjacentWidgetId; sidebarWidgetsSetting( sidebarWidgetIds ); }, /** * Toggle visibility of the widget move area * * @param {Boolean} [showOrHide] */ toggleWidgetMoveArea: function( showOrHide ) { var self = this, $moveWidgetArea; $moveWidgetArea = this.container.find( '.move-widget-area' ); if ( typeof showOrHide === 'undefined' ) { showOrHide = ! $moveWidgetArea.hasClass( 'active' ); } if ( showOrHide ) { // reset the selected sidebar $moveWidgetArea.find( '.selected' ).removeClass( 'selected' ); $moveWidgetArea.find( 'li' ).filter( function() { return $( this ).data( 'id' ) === self.params.sidebar_id; } ).addClass( 'selected' ); this.container.find( '.move-widget-btn' ).prop( 'disabled', true ); } $moveWidgetArea.toggleClass( 'active', showOrHide ); }, /** * Highlight the widget control and section */ highlightSectionAndControl: function() { var $target; if ( this.container.is( ':hidden' ) ) { $target = this.container.closest( '.control-section' ); } else { $target = this.container; } $( '.highlighted' ).removeClass( 'highlighted' ); $target.addClass( 'highlighted' ); setTimeout( function() { $target.removeClass( 'highlighted' ); }, 500 ); } } ); /** * wp.customize.Widgets.SidebarControl * * Customizer control for widgets. * Note that 'sidebar_widgets' must match the WP_Widget_Area_Customize_Control::$type * * @constructor * @augments wp.customize.Control */ api.Widgets.SidebarControl = api.Control.extend({ /** * Set up the control */ ready: function() { this.$controlSection = this.container.closest( '.control-section' ); this.$sectionContent = this.container.closest( '.accordion-section-content' ); this._setupModel(); this._setupSortable(); this._setupAddition(); this._applyCardinalOrderClassNames(); }, /** * Update ordering of widget control forms when the setting is updated */ _setupModel: function() { var self = this, registeredSidebar = api.Widgets.registeredSidebars.get( this.params.sidebar_id ); this.setting.bind( function( newWidgetIds, oldWidgetIds ) { var widgetFormControls, $sidebarWidgetsAddControl, finalControlContainers, removedWidgetIds; removedWidgetIds = _( oldWidgetIds ).difference( newWidgetIds ); // Filter out any persistent widget IDs for widgets which have been deactivated newWidgetIds = _( newWidgetIds ).filter( function( newWidgetId ) { var parsedWidgetId = parseWidgetId( newWidgetId ); return !! api.Widgets.availableWidgets.findWhere( { id_base: parsedWidgetId.id_base } ); } ); widgetFormControls = _( newWidgetIds ).map( function( widgetId ) { var widgetFormControl = api.Widgets.getWidgetFormControlForWidget( widgetId ); if ( ! widgetFormControl ) { widgetFormControl = self.addWidget( widgetId ); } return widgetFormControl; } ); // Sort widget controls to their new positions widgetFormControls.sort( function( a, b ) { var aIndex = _.indexOf( newWidgetIds, a.params.widget_id ), bIndex = _.indexOf( newWidgetIds, b.params.widget_id ); if ( aIndex === bIndex ) { return 0; } return aIndex < bIndex ? -1 : 1; } ); // Append the controls to put them in the right order finalControlContainers = _( widgetFormControls ).map( function( widgetFormControls ) { return widgetFormControls.container[0]; } ); $sidebarWidgetsAddControl = self.$sectionContent.find( '.customize-control-sidebar_widgets' ); $sidebarWidgetsAddControl.before( finalControlContainers ); // Re-sort widget form controls (including widgets form other sidebars newly moved here) self._applyCardinalOrderClassNames(); // If the widget was dragged into the sidebar, make sure the sidebar_id param is updated _( widgetFormControls ).each( function( widgetFormControl ) { widgetFormControl.params.sidebar_id = self.params.sidebar_id; } ); // Cleanup after widget removal _( removedWidgetIds ).each( function( removedWidgetId ) { // Using setTimeout so that when moving a widget to another sidebar, the other sidebars_widgets settings get a chance to update setTimeout( function() { var removedControl, wasDraggedToAnotherSidebar, inactiveWidgets, removedIdBase, widget, isPresentInAnotherSidebar = false; // Check if the widget is in another sidebar api.each( function( otherSetting ) { if ( otherSetting.id === self.setting.id || 0 !== otherSetting.id.indexOf( 'sidebars_widgets[' ) || otherSetting.id === 'sidebars_widgets[wp_inactive_widgets]' ) { return; } var otherSidebarWidgets = otherSetting(), i; i = _.indexOf( otherSidebarWidgets, removedWidgetId ); if ( -1 !== i ) { isPresentInAnotherSidebar = true; } } ); // If the widget is present in another sidebar, abort! if ( isPresentInAnotherSidebar ) { return; } removedControl = api.Widgets.getWidgetFormControlForWidget( removedWidgetId ); // Detect if widget control was dragged to another sidebar wasDraggedToAnotherSidebar = removedControl && $.contains( document, removedControl.container[0] ) && ! $.contains( self.$sectionContent[0], removedControl.container[0] ); // Delete any widget form controls for removed widgets if ( removedControl && ! wasDraggedToAnotherSidebar ) { api.control.remove( removedControl.id ); removedControl.container.remove(); } // Move widget to inactive widgets sidebar (move it to trash) if has been previously saved // This prevents the inactive widgets sidebar from overflowing with throwaway widgets if ( api.Widgets.savedWidgetIds[removedWidgetId] ) { inactiveWidgets = api.value( 'sidebars_widgets[wp_inactive_widgets]' )().slice(); inactiveWidgets.push( removedWidgetId ); api.value( 'sidebars_widgets[wp_inactive_widgets]' )( _( inactiveWidgets ).unique() ); } // Make old single widget available for adding again removedIdBase = parseWidgetId( removedWidgetId ).id_base; widget = api.Widgets.availableWidgets.findWhere( { id_base: removedIdBase } ); if ( widget && ! widget.get( 'is_multi' ) ) { widget.set( 'is_disabled', false ); } } ); } ); } ); // Update the model with whether or not the sidebar is rendered api.Widgets.Previewer.bind( 'rendered-sidebars', function( renderedSidebars ) { var isRendered = !! renderedSidebars[self.params.sidebar_id]; registeredSidebar.set( 'is_rendered', isRendered ); } ); // Show the sidebar section when it becomes visible registeredSidebar.on( 'change:is_rendered', function( ) { var sectionSelector = '#accordion-section-sidebar-widgets-' + this.get( 'id' ), $section; $section = $( sectionSelector ); if ( this.get( 'is_rendered' ) ) { $section.stop().slideDown( function() { $( this ).css( 'height', 'auto' ); // so that the .accordion-section-content won't overflow } ); } else { // Make sure that hidden sections get closed first if ( $section.hasClass( 'open' ) ) { // it would be nice if accordionSwitch() in accordion.js was public $section.find( '.accordion-section-title' ).trigger( 'click' ); } $section.stop().slideUp(); } } ); }, /** * Allow widgets in sidebar to be re-ordered, and for the order to be previewed */ _setupSortable: function() { var self = this; this.isReordering = false; /** * Update widget order setting when controls are re-ordered */ this.$sectionContent.sortable( { items: '> .customize-control-widget_form', handle: '.widget-top', axis: 'y', connectWith: '.accordion-section-content:has(.customize-control-sidebar_widgets)', update: function() { var widgetContainerIds = self.$sectionContent.sortable( 'toArray' ), widgetIds; widgetIds = $.map( widgetContainerIds, function( widgetContainerId ) { return $( '#' + widgetContainerId ).find( ':input[name=widget-id]' ).val(); } ); self.setting( widgetIds ); } } ); /** * Expand other customizer sidebar section when dragging a control widget over it, * allowing the control to be dropped into another section */ this.$controlSection.find( '.accordion-section-title' ).droppable({ accept: '.customize-control-widget_form', over: function() { if ( ! self.$controlSection.hasClass( 'open' ) ) { self.$controlSection.addClass( 'open' ); self.$sectionContent.toggle( false ).slideToggle( 150, function() { self.$sectionContent.sortable( 'refreshPositions' ); } ); } } }); /** * Keyboard-accessible reordering */ this.container.find( '.reorder-toggle' ).on( 'click keydown', function( event ) { if ( event.type === 'keydown' && ! ( event.which === 13 || event.which === 32 ) ) { // Enter or Spacebar return; } self.toggleReordering( ! self.isReordering ); } ); }, /** * Set up UI for adding a new widget */ _setupAddition: function() { var self = this; this.container.find( '.add-new-widget' ).on( 'click keydown', function( event ) { if ( event.type === 'keydown' && ! ( event.which === 13 || event.which === 32 ) ) { // Enter or Spacebar return; } if ( self.$sectionContent.hasClass( 'reordering' ) ) { return; } if ( ! $( 'body' ).hasClass( 'adding-widget' ) ) { api.Widgets.availableWidgetsPanel.open( self ); } else { api.Widgets.availableWidgetsPanel.close(); } } ); }, /** * Add classes to the widget_form controls to assist with styling */ _applyCardinalOrderClassNames: function() { this.$sectionContent.find( '.customize-control-widget_form' ) .removeClass( 'first-widget' ) .removeClass( 'last-widget' ) .find( '.move-widget-down, .move-widget-up' ).prop( 'tabIndex', 0 ); this.$sectionContent.find( '.customize-control-widget_form:first' ) .addClass( 'first-widget' ) .find( '.move-widget-up' ).prop( 'tabIndex', -1 ); this.$sectionContent.find( '.customize-control-widget_form:last' ) .addClass( 'last-widget' ) .find( '.move-widget-down' ).prop( 'tabIndex', -1 ); }, /*********************************************************************** * Begin public API methods **********************************************************************/ /** * Enable/disable the reordering UI * * @param {Boolean} showOrHide to enable/disable reordering */ toggleReordering: function( showOrHide ) { showOrHide = Boolean( showOrHide ); if ( showOrHide === this.$sectionContent.hasClass( 'reordering' ) ) { return; } this.isReordering = showOrHide; this.$sectionContent.toggleClass( 'reordering', showOrHide ); if ( showOrHide ) { _( this.getWidgetFormControls() ).each( function( formControl ) { formControl.collapseForm(); } ); } }, /** * @return {wp.customize.controlConstructor.widget_form[]} */ getWidgetFormControls: function() { var formControls; formControls = _( this.setting() ).map( function( widgetId ) { var settingId = widgetIdToSettingId( widgetId ), formControl = api.control( settingId ); if ( ! formControl ) { return; } return formControl; } ); return formControls; }, /** * @param {string} widgetId or an id_base for adding a previously non-existing widget * @returns {object|false} widget_form control instance, or false on error */ addWidget: function( widgetId ) { var self = this, controlHtml, $widget, controlType = 'widget_form', $control, controlConstructor, parsedWidgetId = parseWidgetId( widgetId ), widgetNumber = parsedWidgetId.number, widgetIdBase = parsedWidgetId.id_base, widget = api.Widgets.availableWidgets.findWhere( {id_base: widgetIdBase} ), settingId, isExistingWidget, widgetFormControl, sidebarWidgets, settingArgs; if ( ! widget ) { return false; } if ( widgetNumber && ! widget.get( 'is_multi' ) ) { return false; } // Set up new multi widget if ( widget.get( 'is_multi' ) && ! widgetNumber ) { widget.set( 'multi_number', widget.get( 'multi_number' ) + 1 ); widgetNumber = widget.get( 'multi_number' ); } controlHtml = $.trim( $( '#widget-tpl-' + widget.get( 'id' ) ).html() ); if ( widget.get( 'is_multi' ) ) { controlHtml = controlHtml.replace( /<[^<>]+>/g, function( m ) { return m.replace( /__i__|%i%/g, widgetNumber ); } ); } else { widget.set( 'is_disabled', true ); // Prevent single widget from being added again now } $widget = $( controlHtml ); $control = $( '<li/>' ) .addClass( 'customize-control' ) .addClass( 'customize-control-' + controlType ) .append( $widget ); // Remove icon which is visible inside the panel $control.find( '> .widget-icon' ).remove(); if ( widget.get( 'is_multi' ) ) { $control.find( 'input[name="widget_number"]' ).val( widgetNumber ); $control.find( 'input[name="multi_number"]' ).val( widgetNumber ); } widgetId = $control.find( '[name="widget-id"]' ).val(); $control.hide(); // to be slid-down below settingId = 'widget_' + widget.get( 'id_base' ); if ( widget.get( 'is_multi' ) ) { settingId += '[' + widgetNumber + ']'; } $control.attr( 'id', 'customize-control-' + settingId.replace( /\]/g, '' ).replace( /\[/g, '-' ) ); this.container.after( $control ); // Only create setting if it doesn't already exist (if we're adding a pre-existing inactive widget) isExistingWidget = api.has( settingId ); if ( ! isExistingWidget ) { settingArgs = { transport: 'refresh', previewer: this.setting.previewer }; api.create( settingId, settingId, {}, settingArgs ); } controlConstructor = api.controlConstructor[controlType]; widgetFormControl = new controlConstructor( settingId, { params: { settings: { 'default': settingId }, sidebar_id: self.params.sidebar_id, widget_id: widgetId, widget_id_base: widget.get( 'id_base' ), type: controlType, is_new: ! isExistingWidget, width: widget.get( 'width' ), height: widget.get( 'height' ), is_wide: widget.get( 'is_wide' ) }, previewer: self.setting.previewer } ); api.control.add( settingId, widgetFormControl ); // Make sure widget is removed from the other sidebars api.each( function( otherSetting ) { if ( otherSetting.id === self.setting.id ) { return; } if ( 0 !== otherSetting.id.indexOf( 'sidebars_widgets[' ) ) { return; } var otherSidebarWidgets = otherSetting().slice(), i = _.indexOf( otherSidebarWidgets, widgetId ); if ( -1 !== i ) { otherSidebarWidgets.splice( i ); otherSetting( otherSidebarWidgets ); } } ); // Add widget to this sidebar sidebarWidgets = this.setting().slice(); if ( -1 === _.indexOf( sidebarWidgets, widgetId ) ) { sidebarWidgets.push( widgetId ); this.setting( sidebarWidgets ); } $control.slideDown( function() { if ( isExistingWidget ) { widgetFormControl.expandForm(); widgetFormControl.updateWidget( { instance: widgetFormControl.setting(), complete: function( error ) { if ( error ) { throw error; } widgetFormControl.focus(); } } ); } else { widgetFormControl.focus(); } } ); $( document ).trigger( 'widget-added', [ $widget ] ); return widgetFormControl; } } ); /** * Extends wp.customizer.controlConstructor with control constructor for * widget_form and sidebar_widgets. */ $.extend( api.controlConstructor, { widget_form: api.Widgets.WidgetControl, sidebar_widgets: api.Widgets.SidebarControl }); /** * Capture the instance of the Previewer since it is private */ OldPreviewer = api.Previewer; api.Previewer = OldPreviewer.extend({ initialize: function( params, options ) { api.Widgets.Previewer = this; OldPreviewer.prototype.initialize.call( this, params, options ); this.bind( 'refresh', this.refresh ); } } ); /** * Init Customizer for widgets. */ api.bind( 'ready', function() { // Set up the widgets panel api.Widgets.availableWidgetsPanel = new api.Widgets.AvailableWidgetsPanelView({ collection: api.Widgets.availableWidgets }); // Highlight widget control api.Widgets.Previewer.bind( 'highlight-widget-control', api.Widgets.highlightWidgetFormControl ); // Open and focus widget control api.Widgets.Previewer.bind( 'focus-widget-control', api.Widgets.focusWidgetFormControl ); } ); /** * Highlight a widget control. * * @param {string} widgetId */ api.Widgets.highlightWidgetFormControl = function( widgetId ) { var control = api.Widgets.getWidgetFormControlForWidget( widgetId ); if ( control ) { control.highlightSectionAndControl(); } }, /** * Focus a widget control. * * @param {string} widgetId */ api.Widgets.focusWidgetFormControl = function( widgetId ) { var control = api.Widgets.getWidgetFormControlForWidget( widgetId ); if ( control ) { control.focus(); } }, /** * Given a widget control, find the sidebar widgets control that contains it. * @param {string} widgetId * @return {object|null} */ api.Widgets.getSidebarWidgetControlContainingWidget = function( widgetId ) { var foundControl = null; // @todo this can use widgetIdToSettingId(), then pass into wp.customize.control( x ).getSidebarWidgetsControl() api.control.each( function( control ) { if ( control.params.type === 'sidebar_widgets' && -1 !== _.indexOf( control.setting(), widgetId ) ) { foundControl = control; } } ); return foundControl; }; /** * Given a widget ID for a widget appearing in the preview, get the widget form control associated with it. * * @param {string} widgetId * @return {object|null} */ api.Widgets.getWidgetFormControlForWidget = function( widgetId ) { var foundControl = null; // @todo We can just use widgetIdToSettingId() here api.control.each( function( control ) { if ( control.params.type === 'widget_form' && control.params.widget_id === widgetId ) { foundControl = control; } } ); return foundControl; }; /** * @param {String} widgetId * @returns {Object} */ function parseWidgetId( widgetId ) { var matches, parsed = { number: null, id_base: null }; matches = widgetId.match( /^(.+)-(\d+)$/ ); if ( matches ) { parsed.id_base = matches[1]; parsed.number = parseInt( matches[2], 10 ); } else { // likely an old single widget parsed.id_base = widgetId; } return parsed; } /** * @param {String} widgetId * @returns {String} settingId */ function widgetIdToSettingId( widgetId ) { var parsed = parseWidgetId( widgetId ), settingId; settingId = 'widget_' + parsed.id_base; if ( parsed.number ) { settingId += '[' + parsed.number + ']'; } return settingId; } })( window.wp, jQuery );
01-wordpress-paypal
trunk/wp-admin/js/customize-widgets.js
JavaScript
gpl3
55,882
/* global postboxes:true, commentL10n:true */ jQuery(document).ready( function($) { postboxes.add_postbox_toggles('comment'); var stamp = $('#timestamp').html(); $('.edit-timestamp').click(function () { if ($('#timestampdiv').is(':hidden')) { $('#timestampdiv').slideDown('normal'); $('.edit-timestamp').hide(); } return false; }); $('.cancel-timestamp').click(function() { $('#timestampdiv').slideUp('normal'); $('#mm').val($('#hidden_mm').val()); $('#jj').val($('#hidden_jj').val()); $('#aa').val($('#hidden_aa').val()); $('#hh').val($('#hidden_hh').val()); $('#mn').val($('#hidden_mn').val()); $('#timestamp').html(stamp); $('.edit-timestamp').show(); return false; }); $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(), newD = new Date( aa, mm - 1, jj, hh, mn ); if ( newD.getFullYear() != aa || (1 + newD.getMonth()) != mm || newD.getDate() != jj || newD.getMinutes() != mn ) { $('.timestamp-wrap', '#timestampdiv').addClass('form-invalid'); return false; } else { $('.timestamp-wrap', '#timestampdiv').removeClass('form-invalid'); } $('#timestampdiv').slideUp('normal'); $('.edit-timestamp').show(); $('#timestamp').html( commentL10n.submittedOn + ' <b>' + $( '#mm option[value="' + mm + '"]' ).text() + ' ' + jj + ', ' + aa + ' @ ' + hh + ':' + mn + '</b> ' ); return false; }); });
01-wordpress-paypal
trunk/wp-admin/js/comment.js
JavaScript
gpl3
1,517