general.php 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311
  1. <?php
  2. /**
  3. * Common functions.
  4. *
  5. * @package Pen
  6. */
  7. if ( ! defined( 'ABSPATH' ) ) {
  8. exit;
  9. }
  10. if ( ! function_exists( 'pen_setup' ) ) {
  11. /**
  12. * Sets up theme defaults and registers support for various WordPress features.
  13. *
  14. * Note that this function is hooked into the after_setup_theme hook, which
  15. * runs before the init hook. The init hook is too late for some features, such
  16. * as indicating support for post thumbnails.
  17. */
  18. function pen_setup() {
  19. if ( pen_filter_input( 'GET', 'pen_preview_color' ) || pen_filter_input( 'GET', 'pen_preview_font' ) ) {
  20. // Disables the "Autoptimize" plugin.
  21. define( 'DONOTMINIFY', true );
  22. // Disables the "WP Super Cache" plugin.
  23. define( 'DONOTCACHEPAGE', true );
  24. }
  25. /**
  26. * Make theme available for translation.
  27. * Translations can be filed in the /languages/ directory.
  28. * If you're building a theme based on Pen, use a find and replace
  29. * to change 'pen' to the name of your theme in all the template files.
  30. */
  31. load_theme_textdomain( 'pen', get_template_directory() . '/languages' );
  32. add_theme_support( 'editor-styles' );
  33. /**
  34. * Let WordPress manage the document title.
  35. * By adding theme support, we declare that this theme does not use a
  36. * hard-coded <title> tag in the document head, and expect WordPress to
  37. * provide it for us.
  38. */
  39. add_theme_support( 'title-tag' );
  40. /**
  41. * Enable support for custom logo.
  42. */
  43. add_theme_support(
  44. 'custom-logo',
  45. array(
  46. 'height' => 512,
  47. 'width' => 512,
  48. 'flex-height' => true,
  49. )
  50. );
  51. /**
  52. * Enable support for Post Thumbnails on posts and pages.
  53. */
  54. add_theme_support( 'post-thumbnails' );
  55. set_post_thumbnail_size( 225, 225, true );
  56. /**
  57. * Adds default RSS feed links to the <head>.
  58. */
  59. add_theme_support( 'automatic-feed-links' );
  60. // This theme uses wp_nav_menu() in one location.
  61. register_nav_menus(
  62. array(
  63. 'primary' => esc_html__( 'Header', 'pen' ),
  64. 'secondary' => esc_html__( 'Footer', 'pen' ),
  65. )
  66. );
  67. /**
  68. * Switch default core markup for search form to output valid HTML5.
  69. */
  70. add_theme_support(
  71. 'html5',
  72. array(
  73. 'search-form',
  74. 'gallery',
  75. 'caption',
  76. 'comment-form',
  77. 'comment-list',
  78. )
  79. );
  80. // Add theme support for selective refresh for widgets.
  81. add_theme_support( 'customize-selective-refresh-widgets' );
  82. /**
  83. * Enable support for Post Formats.
  84. * See https://developer.wordpress.org/themes/functionality/post-formats/
  85. */
  86. add_theme_support(
  87. 'post-formats',
  88. array(
  89. 'aside',
  90. 'image',
  91. 'video',
  92. 'quote',
  93. 'link',
  94. )
  95. );
  96. // Set up the WordPress core custom background feature.
  97. add_theme_support(
  98. 'custom-background',
  99. apply_filters(
  100. 'pen_custom_background_args',
  101. array(
  102. 'default-color' => '333333',
  103. 'default-image' => '',
  104. )
  105. )
  106. );
  107. $theme = wp_get_theme( 'pen' );
  108. define( 'PEN_THEME_VERSION', $theme->get( 'Version' ) );
  109. define( 'PEN_PRESET_COLOR', get_theme_mod( 'pen_preset_color', 'preset_1' ) );
  110. define( 'PEN_PRESET_FONT', get_theme_mod( 'pen_preset_font', 'preset_1' ) );
  111. define( 'PEN_SUPPORT_URL', 'https://wordpress.org/support/theme/pen/' );
  112. add_action( 'wp_ajax_pen_post_meta', 'pen_post_meta_ajax' );
  113. }
  114. add_action( 'after_setup_theme', 'pen_setup' );
  115. }
  116. if ( ! function_exists( 'pen_archive_title_override' ) ) {
  117. /**
  118. * Adds extra markup to archive titles.
  119. *
  120. * @param string $title The title.
  121. * @since Pen 1.0.5
  122. * @return string
  123. */
  124. function pen_archive_title_override( $title ) {
  125. $output = $title;
  126. if ( false !== strpos( $title, ': ' ) ) {
  127. $title = explode( ': ', $title );
  128. $output = '<span class="pen_heading_main">';
  129. $output .= $title[0] . ':';
  130. $output .= '</span>';
  131. unset( $title[0] );
  132. $output .= implode( '', $title );
  133. }
  134. return $output;
  135. }
  136. add_filter( 'get_the_archive_title', 'pen_archive_title_override' );
  137. }
  138. if ( ! function_exists( 'pen_pingback' ) ) {
  139. /**
  140. * Add a pingback URL auto-discovery header for singularly identifiable articles.
  141. *
  142. * @since Pen 1.0.0
  143. * @return void
  144. */
  145. function pen_pingback() {
  146. if ( is_singular() && pings_open() ) {
  147. echo '<link rel="pingback" href="' . esc_url( get_bloginfo( 'pingback_url' ) ) . '">';
  148. }
  149. }
  150. add_action( 'wp_head', 'pen_pingback' );
  151. }
  152. if ( ! function_exists( 'pen_content_width' ) ) {
  153. /**
  154. * Set the content width in pixels, based on the theme's design and stylesheet.
  155. *
  156. * Priority 0 to make it available to lower priority callbacks.
  157. *
  158. * @global int $content_width
  159. */
  160. function pen_content_width() {
  161. $GLOBALS['content_width'] = apply_filters( 'pen_content_width', 1140 );
  162. }
  163. add_action( 'after_setup_theme', 'pen_content_width', 0 );
  164. }
  165. if ( ! function_exists( 'pen_header_background' ) ) {
  166. /**
  167. * Set up the WordPress core custom header feature.
  168. *
  169. * @since Pen 1.0.0
  170. * @return void
  171. */
  172. function pen_header_background() {
  173. add_theme_support(
  174. 'custom-header',
  175. apply_filters(
  176. 'pen_custom_header_args',
  177. array(
  178. 'default-image' => '',
  179. 'default-text-color' => '333333',
  180. 'header-text' => false,
  181. 'width' => 1800,
  182. 'height' => 250,
  183. 'flex-height' => true,
  184. )
  185. )
  186. );
  187. }
  188. add_action( 'after_setup_theme', 'pen_header_background' );
  189. }
  190. if ( ! function_exists( 'pen_body_classes' ) ) {
  191. /**
  192. * Adds custom classes to the array of body_class filter.
  193. *
  194. * @global object $post
  195. *
  196. * @param array $classes Classes for the body element.
  197. *
  198. * @since Pen 1.0.0
  199. * @return array
  200. */
  201. function pen_body_classes( $classes ) {
  202. global $post;
  203. if ( ! is_home() && ! is_front_page() ) {
  204. $classes[] = 'not-home';
  205. }
  206. $sidebars = array(
  207. 'sidebar-header-primary',
  208. 'sidebar-header-secondary',
  209. 'sidebar-top',
  210. 'sidebar-search-top',
  211. 'sidebar-search-left',
  212. 'sidebar-search-right',
  213. 'sidebar-search-bottom',
  214. 'sidebar-left',
  215. 'sidebar-right',
  216. 'sidebar-bottom',
  217. 'sidebar-footer-top',
  218. 'sidebar-footer-left',
  219. 'sidebar-footer-right',
  220. 'sidebar-footer-bottom',
  221. );
  222. foreach ( $sidebars as $sidebar ) {
  223. if ( pen_sidebar_check( $sidebar ) && is_active_sidebar( $sidebar ) ) {
  224. $classes[] = 'visible-' . sanitize_html_class( $sidebar );
  225. } else {
  226. $classes[] = 'invisible-' . sanitize_html_class( $sidebar );
  227. }
  228. }
  229. if ( pen_option_get( 'header_logo_display' ) ) {
  230. $classes[] = 'pen_header_logo_size_' . pen_option_get( 'header_logo_size' );
  231. }
  232. if ( is_multi_author() ) {
  233. $classes[] = 'group-blog';
  234. }
  235. if ( pen_option_get( 'color_site_shadow_display' ) ) {
  236. $classes[] = 'pen_drop_shadow';
  237. }
  238. if ( pen_option_get( 'background_lights_dim' ) ) {
  239. $classes[] = 'pen_background_lights_dim';
  240. }
  241. if ( pen_option_get( 'header_sticky' ) ) {
  242. $classes[] = 'pen_header_sticky';
  243. }
  244. if ( pen_option_get( 'round_corners' ) ) {
  245. $classes[] = 'pen_round_corners';
  246. }
  247. $header_logo = pen_option_get( 'header_logo_display' );
  248. if ( 'none' !== $header_logo ) {
  249. $classes[] = 'pen_header_logo_size_' . pen_option_get( 'header_logo_size' );
  250. }
  251. $classes[] = 'pen_list_effect_' . pen_option_get( 'list_effect' );
  252. $classes[] = 'pen_header_alignment_' . pen_option_get( 'header_alignment' );
  253. $classes[] = 'pen_navigation_alignment_' . pen_option_get( 'navigation_alignment' );
  254. $classes[] = 'pen_footer_alignment_' . pen_option_get( 'footer_alignment' );
  255. $classes[] = 'pen_main_container_' . pen_option_get( 'container_position' );
  256. if ( is_sticky() ) {
  257. $classes[] = 'sticky';
  258. }
  259. if ( is_singular() ) {
  260. $post_id = (int) get_queried_object_id(); // $post->ID doesn't return the correct post ID.
  261. // Hiding parts of the content with Web accessibility and SEO in mind.
  262. $options_content = array(
  263. 'content_header_display' => 'content_header_hide',
  264. 'content_title_display' => 'content_title_hide',
  265. 'content_author_display' => 'content_author_hide',
  266. 'content_date_display' => 'content_date_hide',
  267. 'content_category_display' => 'content_category_hide',
  268. 'content_thumbnail_display' => 'content_thumbnail_hide',
  269. 'content_share_display' => 'content_share_hide',
  270. 'content_tags_display' => 'content_tags_hide',
  271. 'content_footer_display' => 'content_footer_hide',
  272. );
  273. foreach ( $options_content as $option => $class ) {
  274. $display = get_post_meta( $post_id, 'pen_' . $option . '_override', true );
  275. if ( ! $display || 'default' === $display ) {
  276. $display = pen_option_get( $option );
  277. }
  278. if ( ! $display || 'no' === $display ) {
  279. $classes[] = 'pen_' . $class;
  280. }
  281. }
  282. $site_width = get_post_meta( $post_id, 'pen_site_width_override', true );
  283. if ( ! $site_width || 'default' === $site_width ) {
  284. $site_width = pen_option_get( 'site_width' );
  285. }
  286. $classes[] = 'pen_width_' . $site_width;
  287. $header_alignment = get_post_meta( $post_id, 'pen_content_header_alignment_override', true );
  288. if ( ! $header_alignment || 'default' === $header_alignment ) {
  289. $header_alignment = pen_option_get( 'content_header_alignment' );
  290. }
  291. if ( $header_alignment && 'no' !== $header_alignment ) {
  292. $classes[] = 'pen_content_header_center';
  293. }
  294. $title_alignment = get_post_meta( $post_id, 'pen_content_title_alignment_override', true );
  295. if ( ! $title_alignment || 'default' === $title_alignment ) {
  296. $title_alignment = pen_option_get( 'content_title_alignment' );
  297. }
  298. if ( $title_alignment && 'no' !== $title_alignment ) {
  299. $classes[] = 'pen_content_title_center';
  300. }
  301. $thumbnail_rotate = get_post_meta( $post_id, 'pen_content_thumbnail_rotate_override', true );
  302. if ( ! $thumbnail_rotate || 'default' === $thumbnail_rotate ) {
  303. $thumbnail_rotate = pen_option_get( 'content_thumbnail_rotate' );
  304. }
  305. if ( $thumbnail_rotate && 'no' !== $thumbnail_rotate ) {
  306. $classes[] = 'pen_content_thumbnail_rotate';
  307. }
  308. $thumbnail_frame = get_post_meta( $post_id, 'pen_content_thumbnail_frame_override', true );
  309. if ( ! $thumbnail_frame || 'default' === $thumbnail_frame ) {
  310. $thumbnail_frame = pen_option_get( 'content_thumbnail_frame' );
  311. }
  312. if ( $thumbnail_frame && 'no' !== $thumbnail_frame ) {
  313. $classes[] = 'pen_content_thumbnail_frame';
  314. }
  315. $thumbnail_frame_color = get_post_meta( $post_id, 'pen_color_content_thumbnail_frame_override', true );
  316. if ( ! $thumbnail_frame_color || 'default' === $thumbnail_frame_color ) {
  317. $thumbnail_frame_color = pen_option_get( 'color_content_thumbnail_frame' );
  318. }
  319. if ( '#000000' === $thumbnail_frame_color ) {
  320. $classes[] = 'pen_thumbnail_frame_dark';
  321. }
  322. $thumbnail_alignment = get_post_meta( $post_id, 'pen_content_thumbnail_alignment_override', true );
  323. if ( ! $thumbnail_alignment || 'default' === $thumbnail_alignment ) {
  324. $thumbnail_alignment = pen_option_get( 'content_thumbnail_alignment' );
  325. }
  326. $classes[] = 'pen_content_thumbnail_' . $thumbnail_alignment;
  327. $classes[] = 'pen_content_thumbnail_' . pen_option_get( 'content_thumbnail_resize' );
  328. $classes[] = 'pen_singular';
  329. } else {
  330. // Hiding parts of the content with Web accessibility and SEO in mind.
  331. $options_list = array(
  332. 'list_header_display' => 'list_header_hide',
  333. 'list_title_display' => 'list_title_hide',
  334. 'list_author_display' => 'list_author_hide',
  335. 'list_date_display' => 'list_date_hide',
  336. 'list_category_display' => 'list_category_hide',
  337. 'list_thumbnail_display' => 'list_thumbnail_hide',
  338. 'list_summary_display' => 'list_summary_hide',
  339. 'list_footer_display' => 'list_footer_hide',
  340. 'list_tags_display' => 'list_tags_hide',
  341. 'list_button_comment_display' => 'list_button_comment_hide',
  342. 'list_button_edit_display' => 'list_button_edit_hide',
  343. );
  344. foreach ( $options_list as $option => $class ) {
  345. if ( ! pen_option_get( $option ) ) {
  346. $classes[] = 'pen_' . $class;
  347. }
  348. }
  349. $classes[] = 'pen_width_' . pen_option_get( 'site_width' );
  350. if ( pen_option_get( 'list_post_header_alignment' ) ) {
  351. $classes[] = 'pen_list_header_center';
  352. }
  353. if ( pen_option_get( 'list_title_alignment' ) ) {
  354. $classes[] = 'pen_list_title_center';
  355. }
  356. if ( 'none' !== pen_option_get( 'list_animation_reveal' ) ) {
  357. $classes[] = 'pen_has_animation';
  358. } else {
  359. $classes[] = 'pen_no_animation';
  360. }
  361. $classes[] = 'pen_multiple';
  362. $classes[] = 'hfeed';
  363. }
  364. $list_type = pen_list_type();
  365. $classes[] = 'pen_list_' . $list_type;
  366. if ( ! is_singular() ) {
  367. if ( 'masonry' === $list_type ) {
  368. $classes[] = 'pen_masonry_columns_' . pen_option_get( 'list_masonry_columns' );
  369. $classes[] = 'pen_thumbnail_' . pen_option_get( 'list_masonry_thumbnail_effect' );
  370. } else {
  371. // The following apply to all the posts in the list.
  372. if ( '#000000' === pen_option_get( 'color_list_thumbnail_frame' ) ) {
  373. $classes[] = 'pen_thumbnail_frame_dark';
  374. }
  375. $classes[] = 'pen_list_thumbnail_' . pen_option_get( 'list_thumbnail_alignment' );
  376. $classes[] = 'pen_list_thumbnail_' . pen_option_get( 'list_thumbnail_resize' );
  377. if ( pen_option_get( 'list_thumbnail_rotate' ) ) {
  378. $classes[] = 'pen_list_thumbnail_rotate';
  379. }
  380. if ( pen_option_get( 'list_thumbnail_frame' ) ) {
  381. $classes[] = 'pen_list_thumbnail_frame';
  382. }
  383. }
  384. }
  385. if ( class_exists( 'HPCF' ) && is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'HPCF' ) ) {
  386. $classes[] = 'pen_has_contact_form';
  387. }
  388. return $classes;
  389. }
  390. add_filter( 'body_class', 'pen_body_classes' );
  391. }
  392. if ( ! function_exists( 'pen_content_classes' ) ) {
  393. /**
  394. * Content classes.
  395. *
  396. * @since Pen 1.0.3
  397. * @return string
  398. */
  399. function pen_content_classes() {
  400. $classes = 'site-main';
  401. $animation = get_post_meta( get_the_ID(), 'pen_content_animation_reveal_override', true );
  402. if ( ! $animation || 'default' === $animation ) {
  403. $animation = pen_option_get( 'content_animation_reveal' );
  404. }
  405. if ( $animation ) {
  406. $classes .= ' pen_custom_animation_' . $animation;
  407. }
  408. return $classes;
  409. }
  410. }
  411. if ( ! function_exists( 'pen_categorized_blog' ) ) {
  412. /**
  413. * Returns true if a blog has more than 1 category.
  414. *
  415. * @since Pen 1.0.0
  416. * @return bool
  417. */
  418. function pen_categorized_blog() {
  419. $all_the_cool_cats = get_transient( 'pen_categories' );
  420. if ( false === $all_the_cool_cats ) {
  421. // Create an array of all the categories that are attached to posts.
  422. $all_the_cool_cats = get_categories(
  423. array(
  424. 'fields' => 'ids',
  425. 'hide_empty' => 1,
  426. // We only need to know if there is more than one category.
  427. 'number' => 2,
  428. )
  429. );
  430. // Count the number of categories that are attached to the posts.
  431. $all_the_cool_cats = count( $all_the_cool_cats );
  432. set_transient( 'pen_categories', $all_the_cool_cats );
  433. }
  434. if ( $all_the_cool_cats > 1 ) {
  435. // This blog has more than 1 category so pen_categorized_blog should return true.
  436. return true;
  437. } else {
  438. // This blog has only 1 category so pen_categorized_blog should return false.
  439. return false;
  440. }
  441. }
  442. }
  443. if ( ! function_exists( 'pen_category_transient_flusher' ) ) {
  444. /**
  445. * Flush out the transients used in pen_categorized_blog.
  446. *
  447. * @since Pen 1.0.0
  448. * @return void|string
  449. */
  450. function pen_category_transient_flusher() {
  451. if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
  452. return;
  453. }
  454. // Like, beat it. Dig?
  455. delete_transient( 'pen_categories' );
  456. }
  457. add_action( 'edit_category', 'pen_category_transient_flusher' );
  458. add_action( 'save_post', 'pen_category_transient_flusher' );
  459. }
  460. if ( ! function_exists( 'pen_editor_styles' ) ) {
  461. /**
  462. * Adds theme stylesheet to the visual editor.
  463. *
  464. * @uses add_editor_style() Links a stylesheet to visual editor
  465. * @uses get_template_directory_uri() Returns URI of theme directory
  466. * @since Pen 1.0.0
  467. */
  468. function pen_editor_styles() {
  469. add_editor_style( get_template_directory_uri() . '/assets/css/pen-editor.css' );
  470. }
  471. add_action( 'admin_init', 'pen_editor_styles' );
  472. }
  473. if ( ! function_exists( 'pen_class_lists' ) ) {
  474. /**
  475. * Creates a class name for hidden elements.
  476. *
  477. * @param string $option The option ID.
  478. *
  479. * @since Pen 1.0.0
  480. * @return string
  481. */
  482. function pen_class_lists( $option ) {
  483. $hidden = '';
  484. $option = 'pen_list_' . $option;
  485. if ( ! is_singular() ) {
  486. $display = get_post_meta( get_the_ID(), $option, true );
  487. if ( 'no' === $display ) {
  488. $hidden = ' pen_element_hidden';
  489. } elseif ( 'yes' === $display ) {
  490. $hidden = ' pen_element_visible';
  491. } else {
  492. $hidden = ' pen_element_default';
  493. }
  494. }
  495. return $hidden;
  496. }
  497. }
  498. if ( ! function_exists( 'pen_filter_input' ) ) {
  499. /**
  500. * Sanitization function similar to filter_input and filter_input_array.
  501. *
  502. * @param string $source The input source, can be GET, POST, or SERVER.
  503. * @param string $name The input name, false returns an array similar to $_GET etc.
  504. *
  505. * @since Pen 1.0.0
  506. * @return mixed Returns null when source is not provided or input does not exist.
  507. */
  508. function pen_filter_input( $source, $name = false ) {
  509. if ( 'GET' !== $source && 'POST' !== $source && 'SERVER' !== $source ) {
  510. return null;
  511. }
  512. // Gets the sources.
  513. /* phpcs:disable */
  514. if ( 'GET' === $source ) {
  515. $source = $_GET;
  516. } elseif ( 'POST' === $source ) {
  517. $source = $_POST;
  518. } else {
  519. $source = $_SERVER;
  520. }
  521. /* phpcs:enable */
  522. // Sanitization.
  523. if ( ! $name ) {
  524. array_walk_recursive( $source, 'pen_filter_input_help' );
  525. if ( $source ) {
  526. return $source;
  527. } else {
  528. return null;
  529. }
  530. } elseif ( ! isset( $source[ $name ] ) ) {
  531. return null;
  532. } elseif ( is_array( $source[ $name ] ) ) {
  533. array_walk_recursive( $source[ $name ], 'pen_filter_input_help' );
  534. return $source[ $name ];
  535. } else {
  536. return htmlspecialchars( trim( stripslashes( $source[ $name ] ) ), ENT_NOQUOTES, 'UTF-8' );
  537. }
  538. return null;
  539. }
  540. }
  541. if ( ! function_exists( 'pen_filter_input_help' ) ) {
  542. /**
  543. * Helper function necessary for array_walk_recursive on older PHP versions.
  544. *
  545. * @param mixed $value The value to be processed.
  546. *
  547. * @since Pen 1.0.0
  548. * @return void
  549. */
  550. function pen_filter_input_help( &$value ) {
  551. $value = htmlspecialchars( trim( stripslashes( $value ) ), ENT_NOQUOTES, 'UTF-8' );
  552. }
  553. }
  554. if ( ! function_exists( 'pen_list_type' ) ) {
  555. /**
  556. * Returns the content list type.
  557. *
  558. * @since Pen 1.0.5
  559. * @return string
  560. */
  561. function pen_list_type() {
  562. return pen_option_get( 'list_type' );
  563. }
  564. }
  565. if ( ! function_exists( 'pen_animations' ) ) {
  566. /**
  567. * Returns a list of the available animations.
  568. *
  569. * @since Pen 1.0.5
  570. * @return string
  571. */
  572. function pen_animations() {
  573. return array(
  574. 'none' => __( 'None', 'pen' ),
  575. 'bounce' => 'bounce',
  576. 'flash' => 'flash',
  577. 'pulse' => 'pulse',
  578. 'rubberBand' => 'rubberBand',
  579. 'shake' => 'shake',
  580. 'headShake' => 'headShake',
  581. 'swing' => 'swing',
  582. 'tada' => 'tada',
  583. 'wobble' => 'wobble',
  584. 'jello' => 'jello',
  585. 'bounceIn' => 'bounceIn',
  586. 'bounceInDown' => 'bounceInDown',
  587. 'bounceInLeft' => 'bounceInLeft',
  588. 'bounceInRight' => 'bounceInRight',
  589. 'bounceInUp' => 'bounceInUp',
  590. 'fadeIn' => 'fadeIn',
  591. 'fadeInDown' => 'fadeInDown',
  592. 'fadeInDownBig' => 'fadeInDownBig',
  593. 'fadeInLeft' => 'fadeInLeft',
  594. 'fadeInLeftBig' => 'fadeInLeftBig',
  595. 'fadeInRight' => 'fadeInRight',
  596. 'fadeInRightBig' => 'fadeInRightBig',
  597. 'fadeInUp' => 'fadeInUp',
  598. 'fadeInUpBig' => 'fadeInUpBig',
  599. 'flipInX' => 'flipInX',
  600. 'flipInY' => 'flipInY',
  601. 'lightSpeedIn' => 'lightSpeedIn',
  602. 'rotateIn' => 'rotateIn',
  603. 'rotateInDownLeft' => 'rotateInDownLeft',
  604. 'rotateInDownRight' => 'rotateInDownRight',
  605. 'rotateInUpLeft' => 'rotateInUpLeft',
  606. 'rotateInUpRight' => 'rotateInUpRight',
  607. 'jackInTheBox' => 'jackInTheBox',
  608. 'rollIn' => 'rollIn',
  609. 'zoomIn' => 'zoomIn',
  610. 'zoomInDown' => 'zoomInDown',
  611. 'zoomInLeft' => 'zoomInLeft',
  612. 'zoomInRight' => 'zoomInRight',
  613. 'zoomInUp' => 'zoomInUp',
  614. 'slideInDown' => 'slideInDown',
  615. 'slideInLeft' => 'slideInLeft',
  616. 'slideInRight' => 'slideInRight',
  617. 'slideInUp' => 'slideInUp',
  618. );
  619. }
  620. }
  621. if ( ! function_exists( 'pen_class_navigation' ) ) {
  622. /**
  623. * Generates class names for the navigation menu.
  624. *
  625. * @since Pen 1.0.8
  626. * @return string
  627. */
  628. function pen_class_navigation() {
  629. $hover = pen_option_get( 'navigation_hover' );
  630. $arrows = pen_option_get( 'navigation_arrows' );
  631. $separator = pen_option_get( 'navigation_separator' );
  632. $separator_submenu = pen_option_get( 'navigation_separator_submenu' );
  633. $classes = trim(
  634. implode(
  635. ' ',
  636. array(
  637. 'main-navigation',
  638. 'pen_hover_' . ( $hover ? $hover : 'none' ),
  639. 'pen_arrows_' . ( $arrows ? $arrows : 'none' ),
  640. 'pen_separator_' . ( $separator ? $separator : 'none' ),
  641. 'pen_separator_submenu_' . ( $separator_submenu ? $separator_submenu : 'none' ),
  642. )
  643. )
  644. );
  645. return $classes;
  646. }
  647. }
  648. if ( ! function_exists( 'pen_class_animation' ) ) {
  649. /**
  650. * Generates animation class names.
  651. *
  652. * @param string $option_id The option ID.
  653. * @param boolean $echo Whether to echo or return.
  654. *
  655. * @since Pen 1.0.7
  656. * @return void|string
  657. */
  658. function pen_class_animation( $option_id, $echo = true ) {
  659. $animation = pen_option_get( $option_id . '_animation_reveal' );
  660. if ( $animation && 'none' !== $animation ) {
  661. $class = sprintf(
  662. 'pen_animate_on_scroll pen_custom_animation_%s',
  663. sanitize_html_class( $animation )
  664. );
  665. if ( $echo ) {
  666. echo $class; /* phpcs:ignore */
  667. } else {
  668. return $class;
  669. }
  670. }
  671. }
  672. }
  673. if ( ! function_exists( 'pen_url_customizer' ) ) {
  674. /**
  675. * Generates a URL for the customizer.
  676. *
  677. * @param string $focus Focus on specific option.
  678. * @param string $page The active page.
  679. *
  680. * @since Pen 1.0.8
  681. * @return string
  682. */
  683. function pen_url_customizer( $focus = '', $page = '' ) {
  684. if ( is_customize_preview() ) {
  685. return '#';
  686. }
  687. $query['return'] = rawurlencode( pen_filter_input( 'SERVER', 'REQUEST_URI' ) );
  688. if ( $focus && false !== strpos( $focus, ',' ) ) {
  689. list( $container_type, $container_name ) = explode( ',', $focus );
  690. $generic = array(
  691. 'background_image',
  692. 'header_image',
  693. 'nav_menus',
  694. 'title_tagline',
  695. 'widgets',
  696. );
  697. if ( ! in_array( $container_name, $generic, true ) && false === strpos( $container_name, 'sidebar-widgets-' ) ) {
  698. $container_name = 'pen_' . $container_type . '_' . $container_name;
  699. }
  700. $query[ 'autofocus[' . $container_type . ']' ] = $container_name;
  701. }
  702. if ( $page ) {
  703. $query['url'] = rawurlencode( $page );
  704. } elseif ( ! is_admin() ) {
  705. $query['url'] = rawurlencode( pen_filter_input( 'SERVER', 'REQUEST_URI' ) );
  706. }
  707. return esc_url( add_query_arg( $query, wp_customize_url() ) );
  708. }
  709. }
  710. if ( ! function_exists( 'pen_jump_menu' ) ) {
  711. /**
  712. * Provides easier access to various parts of the back-end.
  713. *
  714. * @param string $element Target element.
  715. *
  716. * @since Pen 1.0.8
  717. * @return string
  718. */
  719. function pen_jump_menu( $element ) {
  720. /* phpcs:disable */
  721. switch ( $element ) {
  722. case 'color_schemes':
  723. $preset_color_current = (int) str_replace( 'preset_', '', pen_preset_get( 'color' ) );
  724. $items = array();
  725. for ( $i = 1; $i <= 15; $i++ ) {
  726. $url_customizer = esc_url( add_query_arg( 'url', rawurlencode( pen_filter_input( 'SERVER', 'REQUEST_URI' ) ), wp_customize_url() ) . '&autofocus[panel]=pen_panel_colors&pen_preview_color=' . (int) $i );
  727. $items[ $url_customizer ] = sprintf( __( 'Style %d', 'pen' ), $i );
  728. if ( $i === $preset_color_current ) {
  729. $items[ $url_customizer ] .= sprintf( ' (%s)', __( 'Current', 'pen' ) );
  730. }
  731. }
  732. $menu = array(
  733. 'name' => __( 'Color Schemes', 'pen' ),
  734. 'items' => $items,
  735. );
  736. return $menu;
  737. case 'font_presets':
  738. $preset_font_current = (int) str_replace( 'preset_', '', pen_preset_get( 'font_family' ) );
  739. $items = array();
  740. for ( $i = 1; $i <= 10; $i++ ) {
  741. $url_customizer = esc_url( add_query_arg( 'url', rawurlencode( pen_filter_input( 'SERVER', 'REQUEST_URI' ) ), wp_customize_url() ) . '&autofocus[panel]=pen_panel_typography&pen_preview_font=' . (int) $i );
  742. $items[ $url_customizer ] = sprintf( __( 'Font Preset %d', 'pen' ), $i );
  743. if ( $i === $preset_font_current ) {
  744. $items[ $url_customizer ] .= sprintf( ' (%s)', __( 'Current', 'pen' ) );
  745. }
  746. }
  747. $menu = array(
  748. 'name' => __( 'Font Presets', 'pen' ),
  749. 'items' => $items,
  750. );
  751. return $menu;
  752. case 'site':
  753. $menu = array(
  754. 'name' => __( 'General Settings', 'pen' ),
  755. 'items' => array(
  756. 'section,background_image' => __( '<span>Site </span>Background Image', 'pen' ),
  757. 'section,colors_general' => __( 'Colors', 'pen' ),
  758. 'section,typography_general' => __( 'Typography', 'pen' ),
  759. 'section,layout' => __( '<span>Site </span>Layout', 'pen' ),
  760. ),
  761. );
  762. if ( is_home() || is_front_page() ) {
  763. $menu['items'][ ( 'panel,front' ) ] = __( 'Front Page', 'pen' );
  764. }
  765. return $menu;
  766. case 'header':
  767. return array(
  768. 'name' => __( 'Header', 'pen' ),
  769. 'items' => array(
  770. 'section,header_general' => __( 'General<span> Header Settings</span>', 'pen' ),
  771. 'section,header_image' => __( '<span>Header </span>Background Image', 'pen' ),
  772. 'section,title_tagline' => __( 'Logo', 'pen' ),
  773. 'section,header_search' => __( 'Search', 'pen' ),
  774. 'section,colors_header' => __( '<span>Header </span>Colors', 'pen' ),
  775. 'section,typography_header' => __( '<span>Header </span>Typography', 'pen' ),
  776. 'panel,contact' => __( '<span>Site </span>Contacts', 'pen' ),
  777. ),
  778. );
  779. case 'navigation':
  780. return array(
  781. 'name' => __( 'Navigation', 'pen' ),
  782. 'items' => array(
  783. 'section,header_navigation' => __( 'General<span> Navigation Settings</span>', 'pen' ),
  784. 'panel,nav_menus' => __( 'Menus', 'pen' ),
  785. 'section,background_image_navigation' => __( '<span>Navigation </span>Background Image', 'pen' ),
  786. 'section,colors_navigation' => __( '<span>Navigation </span>Colors', 'pen' ),
  787. 'section,typography_navigation' => __( '<span>Navigation </span>Typography', 'pen' ),
  788. ),
  789. );
  790. case 'search_bar':
  791. return array(
  792. 'name' => __( 'Search Bar', 'pen' ),
  793. 'items' => array(
  794. 'section,header_search' => __( 'General<span> Search Settings</span>', 'pen' ),
  795. 'section,background_image_search' => __( '<span>Search Bar </span>Background Image', 'pen' ),
  796. 'section,colors_search' => __( '<span>Search Bar </span>Colors', 'pen' ),
  797. ),
  798. );
  799. case 'content':
  800. $menu = array(
  801. 'name' => __( 'Content Area', 'pen' ),
  802. 'items' => array(
  803. 'section,content' => __( 'General<span> Content Area Settings</span>', 'pen' ),
  804. 'section,colors_content' => __( '<span>Content Area </span>Colors', 'pen' ),
  805. 'section,layout' => __( '<span>Site </span>Layout', 'pen' ),
  806. ),
  807. );
  808. $post_id = get_the_ID();
  809. if ( $post_id ) {
  810. $url_post_edit = self_admin_url(
  811. sprintf(
  812. 'post.php?post=%d&action=edit',
  813. esc_attr( $post_id )
  814. )
  815. );
  816. $menu['items'][ $url_post_edit ] = sprintf(
  817. /* Translators: %s: post type. */
  818. __( '<span>Edit </span>This %s', 'pen' ),
  819. ucwords( get_post_type() )
  820. );
  821. }
  822. return $menu;
  823. case 'list':
  824. return array(
  825. 'name' => __( 'List Views', 'pen' ),
  826. 'items' => array(
  827. 'section,list' => __( 'General<span> List Views Settings</span>', 'pen' ),
  828. 'section,colors_list' => __( '<span>Content List </span>Colors', 'pen' ),
  829. 'section,layout' => __( '<span>Site </span>Layout', 'pen' ),
  830. ),
  831. );
  832. case 'sidebar-header-primary':
  833. return array(
  834. 'name' => __( 'Header - Primary', 'pen' ),
  835. 'items' => array(
  836. 'section,sidebar-widgets-sidebar-header-primary' => sprintf(
  837. '<span>%1$s </span>%2$s',
  838. __( 'Header - Primary', 'pen' ),
  839. __( 'Configure Widgets', 'pen' )
  840. ),
  841. ),
  842. );
  843. case 'sidebar-header-secondary':
  844. return array(
  845. 'name' => __( 'Header - Secondary', 'pen' ),
  846. 'items' => array(
  847. 'section,sidebar-widgets-sidebar-header-secondary' => sprintf(
  848. '<span>%1$s </span>%2$s',
  849. __( 'Header - Secondary', 'pen' ),
  850. __( 'Configure Widgets', 'pen' )
  851. ),
  852. ),
  853. );
  854. case 'sidebar-top':
  855. return array(
  856. 'name' => sprintf(
  857. __( '"%s" Widget Area', 'pen' ),
  858. __( 'Top', 'pen' )
  859. ),
  860. 'items' => array(
  861. 'section,sidebar-widgets-sidebar-top' => sprintf(
  862. '<span>%1$s </span>%2$s',
  863. sprintf(
  864. __( '"%s" Widget Area', 'pen' ),
  865. __( 'Top', 'pen' )
  866. ),
  867. __( 'Configure Widgets', 'pen' )
  868. ),
  869. ),
  870. );
  871. case 'sidebar-search-top':
  872. return array(
  873. 'name' => sprintf(
  874. __( '"%s" Widget Area', 'pen' ),
  875. __( 'Search - Top', 'pen' )
  876. ),
  877. 'items' => array(
  878. 'section,sidebar-widgets-sidebar-search-top' => sprintf(
  879. '<span>%1$s </span>%2$s',
  880. sprintf(
  881. __( '"%s" Widget Area', 'pen' ),
  882. __( 'Search - Top', 'pen' )
  883. ),
  884. __( 'Configure Widgets', 'pen' )
  885. ),
  886. ),
  887. );
  888. case 'sidebar-search-left':
  889. return array(
  890. 'name' => sprintf(
  891. __( '"%s" Widget Area', 'pen' ),
  892. __( 'Search - Left', 'pen' )
  893. ),
  894. 'items' => array(
  895. 'section,sidebar-widgets-sidebar-search-left' => sprintf(
  896. '<span>%1$s </span>%2$s',
  897. sprintf(
  898. __( '"%s" Widget Area', 'pen' ),
  899. __( 'Search - Left', 'pen' )
  900. ),
  901. __( 'Configure Widgets', 'pen' )
  902. ),
  903. ),
  904. );
  905. case 'sidebar-search-right':
  906. return array(
  907. 'name' => sprintf(
  908. __( '"%s" Widget Area', 'pen' ),
  909. __( 'Search - Right', 'pen' )
  910. ),
  911. 'items' => array(
  912. 'section,sidebar-widgets-sidebar-search-right' => sprintf(
  913. '<span>%1$s </span>%2$s',
  914. sprintf(
  915. __( '"%s" Widget Area', 'pen' ),
  916. __( 'Search - Right', 'pen' )
  917. ),
  918. __( 'Configure Widgets', 'pen' )
  919. ),
  920. ),
  921. );
  922. case 'sidebar-search-bottom':
  923. return array(
  924. 'name' => sprintf(
  925. __( '"%s" Widget Area', 'pen' ),
  926. __( 'Search - Bottom', 'pen' )
  927. ),
  928. 'items' => array(
  929. 'section,sidebar-widgets-sidebar-search-bottom' => sprintf(
  930. '<span>%1$s </span>%2$s',
  931. sprintf(
  932. __( '"%s" Widget Area', 'pen' ),
  933. __( 'Search - Bottom', 'pen' )
  934. ),
  935. __( 'Configure Widgets', 'pen' )
  936. ),
  937. ),
  938. );
  939. case 'sidebar-content-top':
  940. return array(
  941. 'name' => sprintf(
  942. __( '"%s" Widget Area', 'pen' ),
  943. __( 'Content - Top', 'pen' )
  944. ),
  945. 'items' => array(
  946. 'section,sidebar-widgets-sidebar-content-top' => sprintf(
  947. '<span>%1$s </span>%2$s',
  948. sprintf(
  949. __( '"%s" Widget Area', 'pen' ),
  950. __( 'Content - Top', 'pen' )
  951. ),
  952. __( 'Configure Widgets', 'pen' )
  953. ),
  954. ),
  955. );
  956. case 'sidebar-content-bottom':
  957. return array(
  958. 'name' => sprintf(
  959. __( '"%s" Widget Area', 'pen' ),
  960. __( 'Content - Bottom', 'pen' )
  961. ),
  962. 'items' => array(
  963. 'section,sidebar-widgets-sidebar-content-bottom' => sprintf(
  964. '<span>%1$s </span>%2$s',
  965. sprintf(
  966. __( '"%s" Widget Area', 'pen' ),
  967. __( 'Content - Bottom', 'pen' )
  968. ),
  969. __( 'Configure Widgets', 'pen' )
  970. ),
  971. ),
  972. );
  973. case 'sidebar-left':
  974. return array(
  975. 'name' => sprintf(
  976. __( '"%s" Sidebar', 'pen' ),
  977. __( 'Left', 'pen' )
  978. ),
  979. 'items' => array(
  980. 'section,sidebar-widgets-sidebar-left' => sprintf(
  981. '<span>%1$s </span>%2$s',
  982. sprintf(
  983. __( '"%s" Sidebar', 'pen' ),
  984. __( 'Left', 'pen' )
  985. ),
  986. __( 'Configure Widgets', 'pen' )
  987. ),
  988. ),
  989. );
  990. case 'sidebar-right':
  991. return array(
  992. 'name' => sprintf(
  993. __( '"%s" Sidebar', 'pen' ),
  994. __( 'Right', 'pen' )
  995. ),
  996. 'items' => array(
  997. 'section,sidebar-widgets-sidebar-right' => sprintf(
  998. '<span>%1$s </span>%2$s',
  999. sprintf(
  1000. __( '"%s" Sidebar', 'pen' ),
  1001. __( 'Right', 'pen' )
  1002. ),
  1003. __( 'Configure Widgets', 'pen' )
  1004. ),
  1005. ),
  1006. );
  1007. case 'sidebar-bottom':
  1008. return array(
  1009. 'name' => __( 'Bottom', 'pen' ),
  1010. 'items' => array(
  1011. 'section,background_image_bottom' => __( '<span>Bottom Widget Area - </span>Background Image', 'pen' ),
  1012. 'section,colors_bottom' => __( '<span>Bottom Widget Area - </span>Colors', 'pen' ),
  1013. 'section,sidebar-widgets-sidebar-bottom' => sprintf(
  1014. '<span>%1$s </span>%2$s',
  1015. sprintf(
  1016. __( '"%s" Widget Area', 'pen' ),
  1017. __( 'Bottom', 'pen' )
  1018. ),
  1019. __( 'Configure Widgets', 'pen' )
  1020. ),
  1021. ),
  1022. );
  1023. case 'sidebar-footer-top':
  1024. return array(
  1025. 'name' => __( 'Footer - Top', 'pen' ),
  1026. 'items' => array(
  1027. 'section,sidebar-widgets-sidebar-footer-top' => sprintf(
  1028. '<span>%1$s </span>%2$s',
  1029. sprintf(
  1030. __( '"%s" Widget Area', 'pen' ),
  1031. __( 'Footer - Top', 'pen' )
  1032. ),
  1033. __( 'Configure Widgets', 'pen' )
  1034. ),
  1035. ),
  1036. );
  1037. case 'sidebar-footer-left':
  1038. return array(
  1039. 'name' => __( 'Footer - Left', 'pen' ),
  1040. 'items' => array(
  1041. 'section,sidebar-widgets-sidebar-footer-left' => sprintf(
  1042. '<span>%1$s </span>%2$s',
  1043. sprintf(
  1044. __( '"%s" Widget Area', 'pen' ),
  1045. __( 'Footer - Left', 'pen' )
  1046. ),
  1047. __( 'Configure Widgets', 'pen' )
  1048. ),
  1049. ),
  1050. );
  1051. case 'sidebar-footer-right':
  1052. return array(
  1053. 'name' => __( 'Footer - Right', 'pen' ),
  1054. 'items' => array(
  1055. 'section,sidebar-widgets-sidebar-footer-right' => sprintf(
  1056. '<span>%1$s </span>%2$s',
  1057. sprintf(
  1058. __( '"%s" Widget Area', 'pen' ),
  1059. __( 'Footer - Right', 'pen' )
  1060. ),
  1061. __( 'Configure Widgets', 'pen' )
  1062. ),
  1063. ),
  1064. );
  1065. case 'sidebar-footer-bottom':
  1066. return array(
  1067. 'name' => __( 'Footer - Bottom', 'pen' ),
  1068. 'items' => array(
  1069. 'section,sidebar-widgets-sidebar-footer-bottom' => sprintf(
  1070. '<span>%1$s </span>%2$s',
  1071. sprintf(
  1072. __( '"%s" Widget Area', 'pen' ),
  1073. __( 'Footer - Bottom', 'pen' )
  1074. ),
  1075. __( 'Configure Widgets', 'pen' )
  1076. ),
  1077. ),
  1078. );
  1079. case 'footer':
  1080. return array(
  1081. 'name' => __( 'Footer', 'pen' ),
  1082. 'items' => array(
  1083. 'section,footer' => __( 'General<span> - Footer Settings</span>', 'pen' ),
  1084. 'section,background_image_footer' => __( '<span>Footer - </span>Background Image', 'pen' ),
  1085. 'section,colors_footer' => __( '<span>Footer - </span>Colors', 'pen' ),
  1086. 'section,typography_footer' => __( '<span>Footer - </span>Typography', 'pen' ),
  1087. 'panel,contact' => __( '<span>Site </span>Contacts', 'pen' ),
  1088. ),
  1089. );
  1090. }
  1091. /* phpcs:enable */
  1092. }
  1093. }
  1094. if ( ! function_exists( 'pen_post_meta_options' ) ) {
  1095. /**
  1096. * Returns a list of post meta options.
  1097. *
  1098. * @param string $group Which group of options to return.
  1099. *
  1100. * @since Pen 1.0.5
  1101. * @return array
  1102. */
  1103. function pen_post_meta_options( $group = 'all' ) {
  1104. /* phpcs:disable */
  1105. $options_list = array(
  1106. // Do not reorder alphabetically.
  1107. 'pen_list_post_header_alignment_override' => __( 'Center-align content header', 'pen' ),
  1108. 'pen_list_title_alignment_override' => __( 'Center-align content title', 'pen' ),
  1109. 'pen_list_title_display_override' => __( 'Content title', 'pen' ),
  1110. 'pen_list_animation_reveal_override' => __( 'Content animation', 'pen' ),
  1111. 'pen_list_author_display_override' => __( 'Content author', 'pen' ),
  1112. 'pen_list_date_display_override' => __( 'Content date', 'pen' ),
  1113. 'pen_list_date_location_override' => __( 'Content date location', 'pen' ),
  1114. 'pen_list_footer_display_override' => __( 'Content footer', 'pen' ),
  1115. 'pen_list_header_display_override' => __( 'Content header', 'pen' ),
  1116. 'pen_list_summary_display_override' => __( 'Content summary', 'pen' ),
  1117. 'pen_list_tags_display_override' => __( 'Content tags', 'pen' ),
  1118. 'pen_list_thumbnail_animation_reveal_override' => __( 'Content animation', 'pen' ),
  1119. 'pen_list_category_display_override' => __( 'Category links', 'pen' ),
  1120. 'pen_list_category_location_override' => __( 'Category links location', 'pen' ),
  1121. 'pen_list_profile_display_override' => __( 'Author profile', 'pen' ),
  1122. 'pen_list_author_location_override' => __( 'Author link location', 'pen' ),
  1123. 'pen_list_share_location_override' => __( 'Share buttons location', 'pen' ),
  1124. 'pen_list_background_image_content_title_dynamic_override' => __( 'Featured image as title background', 'pen' ),
  1125. 'pen_list_thumbnail_display_override' => __( 'Thumbnail', 'pen' ),
  1126. 'pen_list_thumbnail_alignment_override' => __( 'Thumbnail alignment', 'pen' ),
  1127. 'pen_color_list_thumbnail_frame_override' => __( 'Thumbnail frame color', 'pen' ),
  1128. 'pen_list_thumbnail_frame_override' => __( 'Thumbnail frame', 'pen' ),
  1129. 'pen_list_thumbnail_resize_override' => __( 'Thumbnail size', 'pen' ),
  1130. 'pen_list_thumbnail_rotate_override' => __( 'Thumbnail rotate', 'pen' ),
  1131. 'pen_list_masonry_thumbnail_style_override' => __( 'Thumbnail style', 'pen' ),
  1132. 'pen_list_button_comment_display_override' => __( 'Comment button', 'pen' ),
  1133. 'pen_list_button_edit_display_override' => __( 'Edit button', 'pen' ),
  1134. );
  1135. $options_content = array(
  1136. // Do not reorder alphabetically.
  1137. 'pen_site_width_override' => __( 'Site Width', 'pen' ),
  1138. 'pen_content_header_alignment_override' => __( 'Center-align content header', 'pen' ),
  1139. 'pen_content_title_alignment_override' => __( 'Center-align content title', 'pen' ),
  1140. 'pen_content_title_display_override' => __( 'Content title', 'pen' ),
  1141. 'pen_content_animation_reveal_override' => __( 'Content area animation', 'pen' ),
  1142. 'pen_content_author_display_override' => __( 'Content author', 'pen' ),
  1143. 'pen_content_date_display_override' => __( 'Content date', 'pen' ),
  1144. 'pen_content_date_location_override' => __( 'Content date location', 'pen' ),
  1145. 'pen_content_footer_display_override' => __( 'Content footer', 'pen' ),
  1146. 'pen_content_header_display_override' => __( 'Content header', 'pen' ),
  1147. 'pen_content_tags_display_override' => __( 'Content tags', 'pen' ),
  1148. 'pen_content_profile_display_override' => __( 'Author profile', 'pen' ),
  1149. 'pen_content_author_location_override' => __( 'Author link location', 'pen' ),
  1150. 'pen_content_share_display_override' => __( 'Share buttons', 'pen' ),
  1151. 'pen_content_share_location_override' => __( 'Share buttons location', 'pen' ),
  1152. 'pen_content_category_display_override' => __( 'Category links', 'pen' ),
  1153. 'pen_content_category_location_override' => __( 'Category links location', 'pen' ),
  1154. 'pen_content_search_display_override' => __( 'Search box', 'pen' ),
  1155. 'pen_content_search_location_override' => __( 'Search box location', 'pen' ),
  1156. 'pen_content_background_image_content_title_dynamic_override' => __( 'Featured image as title background', 'pen' ),
  1157. 'pen_content_thumbnail_display_override' => __( 'Thumbnail', 'pen' ),
  1158. 'pen_color_content_thumbnail_frame_override' => __( 'Thumbnail frame color', 'pen' ),
  1159. 'pen_content_thumbnail_alignment_override' => __( 'Thumbnail alignment', 'pen' ),
  1160. 'pen_content_thumbnail_animation_reveal_override' => __( 'Thumbnail animation', 'pen' ),
  1161. 'pen_content_thumbnail_frame_override' => __( 'Thumbnail frame', 'pen' ),
  1162. 'pen_content_thumbnail_resize_override' => __( 'Thumbnail size', 'pen' ),
  1163. 'pen_content_thumbnail_rotate_override' => __( 'Thumbnail rotate', 'pen' ),
  1164. );
  1165. $options_sidebar = array(
  1166. 'pen_sidebar_header_primary_display' => __( 'Header - Primary', 'pen' ),
  1167. 'pen_sidebar_header_secondary_display' => __( 'Header - Secondary', 'pen' ),
  1168. 'pen_sidebar_search_top_display' => __( 'Search - Top', 'pen' ),
  1169. 'pen_sidebar_search_left_display' => __( 'Search - Left', 'pen' ),
  1170. 'pen_sidebar_search_right_display' => __( 'Search - Right', 'pen' ),
  1171. 'pen_sidebar_search_bottom_display' => __( 'Search - Bottom', 'pen' ),
  1172. 'pen_sidebar_top_display' => __( 'Top', 'pen' ),
  1173. 'pen_sidebar_left_display' => __( 'Left', 'pen' ),
  1174. 'pen_sidebar_right_display' => __( 'Right', 'pen' ),
  1175. 'pen_sidebar_content_top_display' => __( 'Content - Top', 'pen' ),
  1176. 'pen_sidebar_content_bottom_display' => __( 'Content - Bottom', 'pen' ),
  1177. 'pen_sidebar_bottom_display' => __( 'Bottom', 'pen' ),
  1178. 'pen_sidebar_footer_top_display' => __( 'Footer - Top', 'pen' ),
  1179. 'pen_sidebar_footer_left_display' => __( 'Footer - Left', 'pen' ),
  1180. 'pen_sidebar_footer_right_display' => __( 'Footer - Right', 'pen' ),
  1181. 'pen_sidebar_footer_bottom_display' => __( 'Footer - Bottom', 'pen' ),
  1182. );
  1183. /* phpcs:enable */
  1184. if ( ! $group || 'all' === $group ) {
  1185. return array_merge( $options_list, $options_content, $options_sidebar );
  1186. }
  1187. if ( 'list' === $group ) {
  1188. return $options_list;
  1189. }
  1190. if ( 'content' === $group ) {
  1191. return $options_content;
  1192. }
  1193. if ( 'sidebar' === $group ) {
  1194. return $options_sidebar;
  1195. }
  1196. }
  1197. }