general.php 41 KB

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