Advertisement
Guest User

blogheader.php

a guest
Nov 9th, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.91 KB | None | 0 0
  1. blogheader.php
  2.  
  3. <?php
  4.  
  5. class ppBlogHeader {
  6.  
  7. const FOR_MOBILE = true;
  8. protected static $layout;
  9. protected static $hTag;
  10. protected static $mastheadImgNum;
  11. protected static $mastheadHasOverrideImg;
  12. protected static $elements = array();
  13. protected static $usingSubnav;
  14. protected static $subnavPlacement;
  15.  
  16. public static function markup() {
  17. do_action( 'pp_pre_header' );
  18.  
  19. $markup = '';
  20. self::$hTag = is_singular() ? 'h2' : 'h1';
  21.  
  22. if ( ppHelper::logoInMasthead() ) {
  23. $markup .= self::maybeAddSubNav( 1 );
  24. $markup .= NrHtml::div( self::logo() . self::masthead(), 'id=masthead&class=sc' );
  25. $markup .= self::maybeAddSubNav( 2 );
  26. $markup .= self::nav();
  27. $markup .= self::maybeAddSubNav( 3 );
  28.  
  29. } else {
  30.  
  31. $orderedElements = self::orderedElements();
  32.  
  33. if ( !NrUtil::isIn( 'logo', self::$layout ) ) {
  34. $markup .= ppUtil::renderView( 'header_alt_h', array( 'hTag' => self::$hTag ), ppUtil::RETURN_VIEW );
  35. }
  36.  
  37. $markup .= self::maybeAddSubNav( $subNavIndex = 1 );
  38. foreach ( $orderedElements as $element ) {
  39. if ( 'masthead' == $element && !ppHelper::skipMasthead() ) {
  40. $markup .= NrHtml::div( self::masthead(), 'id=masthead&class=sc' );
  41. } else {
  42. $markup .= self::$element();
  43. }
  44. $subNavIndex++;
  45. $markup .= self::maybeAddSubNav( $subNavIndex );
  46. }
  47. $markup .= self::maybeAddSubNav( $subNavIndex + 1 );
  48. }
  49.  
  50. return apply_filters( 'pp_blog_header_markup', NrHtml::tag( 'header', $markup , 'class=sc' ) );
  51. }
  52.  
  53. public static function mastheadDims( $mobileWidth = null, $considerRequestingBrowser = true ) {
  54. $blogWidth = ppOpt::id( 'blog_width', 'int' );
  55.  
  56. if ( is_int( $mobileWidth ) ) {
  57. $widthConstraint = $mobileWidth;
  58. $mb_ = ppOpt::test( 'mobile_masthead_use_desktop_settings', 'false' ) ? 'mobile_' : '';
  59. } else {
  60. $widthConstraint = $blogWidth;
  61. $mb_ = '';
  62. }
  63.  
  64. $img = self::mastheadImgTag( $mb_ );
  65.  
  66. $frameImg = ppImg::id( 'masthead_frame' );
  67. $frameOffsetLeft = ppOpt::id( 'masthead_frame_padding_left', 'int' );
  68. $frameOffsetRight = ppOpt::id( 'masthead_frame_padding_right', 'int' );
  69. $frameOffsetTop = ppOpt::id( 'masthead_frame_padding_top', 'int' );
  70. $frameOffsetBottom = ppOpt::id( 'masthead_frame_padding_bottom', 'int' );
  71.  
  72. if ( is_int( $mobileWidth ) ) {
  73. $width = $widthConstraint;
  74. $height = intval( NrUtil::constrainRectSide( $width, $img->width(), $img->height() ) );
  75.  
  76. } else if ( !ppHelper::logoInMasthead() ) {
  77.  
  78. if ( !$frameImg->exists ) {
  79. $width = $widthConstraint;
  80. $height = intval( NrUtil::constrainRectSide( $width, $img->width(), $img->height() ) );
  81.  
  82. } else {
  83. $width = $blogWidth - $frameOffsetLeft - $frameOffsetRight;
  84. if ( $frameImg->width > $widthConstraint ) {
  85. $frameHeight = intval( NrUtil::constrainRectSide( $widthConstraint, $frameImg->width, $frameImg->height ) );
  86. } else {
  87. $frameHeight = $frameImg->height;
  88. }
  89. $height = $frameHeight - $frameOffsetTop - $frameOffsetBottom;
  90. }
  91.  
  92. } else if ( ppOpt::test( 'headerlayout', 'logomasthead_nav || mastheadlogo_nav' ) ) {
  93. $logo = ppImg::id( 'logo' );
  94. $width = $widthConstraint - $logo->width;
  95. $height = $logo->height;
  96. if ( $frameImg->exists ) {
  97. $width = $width - $frameOffsetLeft - $frameOffsetRight;
  98. $height = $height - $frameOffsetTop - $frameOffsetBottom;
  99. }
  100.  
  101. } else if ( ppOpt::test( 'headerlayout', 'mastlogohead_nav' ) ) {
  102. $width = $widthConstraint;
  103. $height = ppImg::id( 'logo' )->height;
  104. if ( $frameImg->exists ) {
  105. $width = $width - $frameOffsetLeft - $frameOffsetRight;
  106. $height = $height - $frameOffsetTop - $frameOffsetBottom;
  107. }
  108.  
  109. } else {
  110. new ppIssue( 'Unexpected condition in ppBlogHeader::mastheadDims()' );
  111. }
  112.  
  113. return (object) compact( 'width', 'height' );
  114. }
  115.  
  116. public static function menuDim( $key, $dim ) {
  117. $key = NrUtil::isIn( 'secondary_', $key ) ? 'secondary_nav_menu_' : 'primary_nav_menu_';
  118. $padding = intval( ppOpt::orVal( $key . 'link_tb_padding', round( ppOpt::id( $key . 'link_font_size' ) * 0.715, 0 ) ) );
  119. $fontsize = ppOpt::id( $key . 'link_font_size', 'int' );
  120. if ( $dim == 'height' ) {
  121. return intval( $fontsize + ( $padding * 2 ) );
  122. } else if ( $dim == 'fontsize' ) {
  123. return $fontsize;
  124. } else if ( $dim == 'padding' ) {
  125. return $padding;
  126. } else {
  127. new ppIssue( 'Invalid $dim param passed to ppBlogHeader::menuDim()' );
  128. }
  129. }
  130.  
  131. protected static function maybeAddSubNav( $index ) {
  132. if ( ppOpt::test( 'secondary_nav_menu_onoff', 'off' ) ) {
  133. return '';
  134. }
  135.  
  136. if ( null === self::$usingSubnav ) {
  137. self::$usingSubnav = ppMenuUtil::menuHasItems( 'secondary_nav_menu' );
  138. }
  139.  
  140. if ( null == self::$subnavPlacement ) {
  141. self::$subnavPlacement = ppOpt::id( 'secondary_nav_menu_placement' );
  142. }
  143.  
  144. if ( self::$usingSubnav && self::$subnavPlacement == strval( $index ) ) {
  145. $menuItems = $menuItems = ppMenuUtil::menuItems( 'secondary_nav_menu' );
  146. $menuItems = self::reorderForSplit( $menuItems, 'secondary' );
  147. $markup = '';
  148. $firstItemID = reset( array_keys( $menuItems ) );
  149. $lastItemID = end( array_keys( $menuItems ) );
  150. foreach ( $menuItems as $itemID => $children ) {
  151. $item = ppMenuUtil::menuItem( $itemID, $children );
  152. if ( $itemID == $firstItemID ) {
  153. $item->addClass( 'first-menu-item' );
  154. }
  155. if ( $itemID == $lastItemID ) {
  156. $item->addClass( 'last-menu-item' );
  157. }
  158. $markup .= $item->markup();
  159. }
  160. $markup = NrHtml::div( NrHtml::ul( $markup, 'class=secondary-nav-menu suckerfish sc' ), 'id=secondary-nav&class=sc' );
  161. $markup .= NrHtml::div( '', 'id=secondary-nav-ajax-receptacle&class=nav-ajax-receptacle sc content-bg' );
  162. return $markup;
  163. } else {
  164. return '';
  165. }
  166. }
  167.  
  168. private static function logo() {
  169. return ppUtil::renderView( 'header_logo', array( 'logo' => ppImg::id( 'logo' ), 'h1or2' => self::$hTag ), ppUtil::RETURN_VIEW );
  170. }
  171.  
  172. private static function reorderForSplit( $menuItems, $which ) {
  173. if ( !ppOpt::test( $which . '_nav_menu_align', 'split' ) || !ppOpt::test( $which . '_nav_menu_split_after_id' ) ) {
  174. return $menuItems;
  175. }
  176.  
  177. if ( $which == 'primary' && ppOpt::test( 'headerlayout', 'pptclassic' ) ) {
  178. return $menuItems;
  179. }
  180.  
  181. $splitIndex = null;
  182. foreach ( array_keys( $menuItems ) as $index => $ID ) {
  183. if ( $ID == ppOpt::id( $which . '_nav_menu_split_after_id' ) ) {
  184. $splitIndex = $index;
  185. }
  186. }
  187. if ( $splitIndex !== null ) {
  188. $leftSide = array_slice( $menuItems, 0, $splitIndex + 1 );
  189. $rightSide = array_reverse( array_slice( $menuItems, $splitIndex + 1, count( $menuItems ) - ( $splitIndex + 1 ) ) );
  190. $menuItems = array_merge( $leftSide, $rightSide );
  191. }
  192.  
  193. return $menuItems;
  194. }
  195.  
  196. public static function nav() {
  197. $markup = '';
  198. if ( ppOpt::test( 'primary_nav_menu_onoff', 'off' ) ) {
  199. return $markup;
  200. }
  201.  
  202. $menuItems = ppMenuUtil::menuItems( 'primary_nav_menu' );
  203.  
  204. if ( !$menuItems ) {
  205. return $markup;
  206. }
  207.  
  208. $menuItems = self::reorderForSplit( $menuItems, 'primary' );
  209.  
  210. $lastItemID = end( array_keys( $menuItems ) );
  211. $firstItemID = reset( array_keys( $menuItems ) );
  212. foreach ( (array) $menuItems as $itemID => $children ) {
  213. $item = ppMenuUtil::menuItem( $itemID, $children );
  214. if ( $itemID == $firstItemID ) {
  215. $item->addClass( 'first-menu-item' );
  216. }
  217. if ( $itemID == $lastItemID ) {
  218. $item->addClass( 'last-menu-item' );
  219. }
  220. $markup .= $item->markup();
  221. }
  222. $markup = NrHtml::tag( 'nav', NrHtml::ul( $markup, 'class=primary-nav-menu suckerfish sc' ), 'id=primary-nav&class=sc' );
  223. $markup .= NrHtml::div( '', 'id=primary-nav-ajax-receptacle&class=nav-ajax-receptacle sc content-bg' );
  224. return $markup;
  225. }
  226.  
  227. private static function masthead() {
  228. if ( ppHelper::skipMasthead() ) {
  229. return '';
  230. }
  231.  
  232. $max = self::mastheadDims();
  233.  
  234. $imgTag = self::mastheadImgTag();
  235. if ( !ppOpt::test( 'headerlayout', 'logomasthead_nav || mastheadlogo_nav' ) ) {
  236. $imgTag = ppGdModify::constrainImgSize( $imgTag, $max->width, $max->height );
  237. }
  238.  
  239. $classes = 'masthead-image';
  240.  
  241. if ( self::mastheadSlideshowOnThisPage() ) {
  242. $classes .= ' pp-slideshow pp-slideshow-not-loaded autostart';
  243. }
  244.  
  245. if ( self::customFlashOnThisPage() ) {
  246. $classes .= ' custom-flash';
  247. }
  248.  
  249. if ( self::$mastheadImgNum && ppOpt::test( 'masthead_image' . self::$mastheadImgNum . '_linkurl' ) ) {
  250. $href = ppUtil::userUrl( 'masthead_image' . self::$mastheadImgNum . '_linkurl' );
  251. } else {
  252. $href = null;
  253. }
  254.  
  255. return ppUtil::renderView( 'header_masthead', array( 'img' => $imgTag, 'classes' => $classes, 'href' => $href ), ppUtil::RETURN_VIEW );
  256. }
  257.  
  258. protected function customFlashOnThisPage() {
  259. if ( !ppOpt::test( 'masthead_display', 'custom' ) ) {
  260. return false;
  261. }
  262. if ( ppOpt::test( 'masthead_modify', 'false' ) ) {
  263. return true;
  264. }
  265. if ( ppOpt::test( 'masthead_on_' . ppUtil::pageType( ppUtil::NO_ARCHIVE_TYPE ), 'modified' ) ) {
  266. return false;
  267. }
  268. return true;
  269. }
  270.  
  271. public function mastheadSlideshowOnThisPage( $prefix_ = '' ) {
  272. if ( !ppOpt::test( "{$prefix_}masthead_display", 'slideshow' ) ) {
  273. return false;
  274.  
  275. } else if ( self::$mastheadHasOverrideImg ) {
  276. return false;
  277.  
  278. } else if ( ppOpt::test( "{$prefix_}masthead_modify", 'false' ) ) {
  279. return self::hasAtLeastTwoMastheadImgs( $prefix_ );
  280.  
  281. } else if ( ppHelper::logoInMasthead() && ppOpt::test( "{$prefix_}masthead_on_" . ppUtil::pageType( ppUtil::NO_ARCHIVE_TYPE ), 'modified' ) ) {
  282. return false;
  283.  
  284. } else if ( ppOpt::test( "{$prefix_}modified_masthead_display", 'image' ) && ppOpt::test( "{$prefix_}masthead_on_" . ppUtil::pageType( ppUtil::NO_ARCHIVE_TYPE ), 'modified' ) ) {
  285. return false;
  286.  
  287. } else {
  288. return self::hasAtLeastTwoMastheadImgs( $prefix_ );
  289. }
  290. }
  291.  
  292. protected function hasAtLeastTwoMastheadImgs( $prefix_ ) {
  293. $foundImgs = 0;
  294. for ( $i = 1; $i <= pp::num()->maxMastheadImages; $i++ ) {
  295. if ( ppImg::id( $prefix_ . 'masthead_image' . $i )->exists ) {
  296. $foundImgs++;
  297. }
  298. if ( $foundImgs > 1 ) {
  299. return true;
  300. }
  301. }
  302. return false;
  303. }
  304.  
  305. protected function mastheadImgTag( $mb_ = '' ) {
  306. if ( $overrideImgUrl = self::mastheadOverrideImg( $mb_ ) ) {
  307. $imgTag = new ppImgTag( $overrideImgUrl );
  308. $imgData = NrUtil::imgData( ppUtil::pathFromUrl( $overrideImgUrl ) );
  309. if ( $imgData ) {
  310. $imgTag->width( $imgData->width );
  311. $imgTag->height( $imgData->height );
  312. }
  313. } else {
  314. self::$mastheadImgNum = self::mastheadImgNum( $mb_ );
  315. $img = ppImg::id( $mb_ . 'masthead_image' . self::$mastheadImgNum );
  316. $imgTag = new ppImgTag( $img->url );
  317. $imgTag->width( $img->width );
  318. $imgTag->height( $img->height );
  319. }
  320. $imgTag->id( 'masthead-img' );
  321. $imgTag->alt( 'Masthead header' );
  322. return $imgTag;
  323. }
  324.  
  325. public static function mastheadImgNum( $mb_ ) {
  326. $mastheadDisplay = ppOpt::id( $mb_ . 'masthead_display' );
  327.  
  328. if ( $mastheadDisplay == 'static' ) {
  329. $imgNum = '1';
  330.  
  331. } else if ( $mastheadDisplay == 'random' ) {
  332. $imgNum = self::randomMastheadImgNum();
  333.  
  334. } else if ( $mastheadDisplay == 'slideshow' && ppOpt::test( 'masthead_slideshow_image_order', 'random' ) ) {
  335. $imgNum = self::randomMastheadImgNum();
  336.  
  337. } else if ( ppOpt::test( $mb_ . 'masthead_modify', 'false' ) ) {
  338. $imgNum = '1';
  339.  
  340. } else if ( ppOpt::test( $mb_ . 'modified_masthead_image' ) &&
  341. ppOpt::test( $mb_ . 'masthead_on_' . ppUtil::pageType( ppUtil::NO_ARCHIVE_TYPE ), 'modified' ) ) {
  342. $imgNum = ppOpt::id( $mb_ . 'modified_masthead_image' );
  343.  
  344. } else {
  345. $imgNum = '1';
  346. }
  347.  
  348. if ( ppImg::id( $mb_ . "masthead_image{$imgNum}" )->exists ) {
  349. return $imgNum;
  350. } else {
  351. return '1';
  352. }
  353. }
  354.  
  355. private static function randomMastheadImgNum() {
  356. $nums = array();
  357. for ( $i = 1; $i <= pp::num()->maxMastheadImages; $i++ ) {
  358. if ( ppImg::id( "masthead_image{$i}" )->exists ) {
  359. $nums[] = strval( $i );
  360. }
  361. }
  362. if ( empty( $nums ) ) {
  363. new ppIssue( 'No masthead imgs found in ppBlogHeader::randomMastheadImgNum()' );
  364. return '1';
  365. }
  366.  
  367. shuffle( $nums );
  368. return array_shift( $nums );
  369. }
  370.  
  371. private static function mastheadOverrideImg() {
  372. if ( pp::site()->hasStaticFrontPage && ppQuery::instance()->isBlogPostsPage() ) {
  373. $articleID = get_option( 'page_for_posts' );
  374. } else if ( is_singular() && ppPost::fromGlobal() ) {
  375. $articleID = ppPost::fromGlobal()->id();
  376. } else {
  377. return false;
  378. }
  379.  
  380. if ( !$customMeta = get_post_meta( $articleID, 'custom_masthead_image', AS_STRING ) ) {
  381. return false;
  382. }
  383.  
  384. if ( is_numeric( $customMeta ) && ppImg::id( "masthead_image$customMeta" )->exists ) {
  385. self::$mastheadHasOverrideImg = true;
  386. return ppImg::id( "masthead_image$customMeta" )->url;
  387.  
  388. } else if ( NrUtil::isWebSafeImg( $customMeta ) ) {
  389. $customImgName = basename( $customMeta );
  390. $customImgPath = pp::fileInfo()->imagesFolderPath . '/' . $customImgName;
  391. if ( file_exists( $customImgPath ) ) {
  392. self::$mastheadHasOverrideImg = true;
  393. return ppUtil::urlFromPath( $customImgPath );
  394. }
  395. }
  396.  
  397. return false;
  398. }
  399.  
  400. private static function orderedElements() {
  401. self::$layout = ppOpt::id( 'headerlayout' );
  402.  
  403. if ( self::$layout == 'pptclassic' ) {
  404. return array( 'logo', 'masthead' );
  405.  
  406. } else {
  407. return explode( '_', str_replace( array( 'left', 'right', 'center' ), '', self::$layout ) );
  408. }
  409. }
  410.  
  411. /* TODO: move this out of this class eventually */
  412. public static function mastheadOptions( $context ) {
  413. if ( $context == 'desktop' ) {
  414. $prefix_ = '';
  415. $Masthead = 'Masthead';
  416. } else {
  417. $prefix_ = 'mobile_';
  418. $Masthead = 'Mobile masthead';
  419. }
  420.  
  421. // DISPLAY options
  422. ppStartMultiple( "$Masthead display" );
  423. if ( $context == 'desktop' && ppHelper::logoInMasthead() && !ppOpt::test( "{$prefix_}masthead_display", 'off' ) ) {
  424. $offOption = array();
  425. } else {
  426. $offOption = array( 'off' => 'do not display masthead' );
  427. }
  428. ppO( "{$prefix_}masthead_display", ppUtil::radioParams( array_merge( $offOption, array(
  429. 'static' => 'single static image',
  430. 'random' => 'random static image',
  431. 'slideshow' => 'slideshow of images',
  432. 'custom' => 'custom uploaded flash .swf file',
  433. ) ) ) );
  434.  
  435. ppO( "{$prefix_}masthead_modify", ppUtil::radioParams( array(
  436. 'false' => 'same masthead on all page types',
  437. 'true' => 'remove or change on some page types',
  438. ) ), 'optionally override the masthead display for select page types' );
  439.  
  440. if ( pp::site()->hasStaticFrontPage ) {
  441. $home = 'posts page';
  442. $static = array( "{$prefix_}masthead_on_front_page" => 'static front page' );
  443. } else {
  444. $home = 'home page';
  445. $static = array();
  446. }
  447. ppO( "{$prefix_}modify_masthead_on", ppUtil::checkboxParams( 'modified', array_merge( $static, array(
  448. $prefix_ . 'masthead_on_home' => $home,
  449. $prefix_ . 'masthead_on_single' => 'individual post pages',
  450. $prefix_ . 'masthead_on_page' => 'static WordPress "Pages"',
  451. $prefix_ . 'masthead_on_archive' => 'archive, category, author, and search',
  452. ) ) ), 'on selected (checked) page types, masthead will be removed or changed' );
  453.  
  454. ppO( "{$prefix_}modified_masthead_display", ppUtil::radioParams( array(
  455. 'none' => 'remove masthead',
  456. 'image' => 'show a single static masthead image',
  457. ) ), 'how to modify masthead on selected pages' );
  458.  
  459. $imgOptions = array();
  460. for ( $i = 1; $i <= pp::num()->maxMastheadImages; $i++ ) {
  461. if ( !ppImg::id( "{$prefix_}masthead_image" . $i )->exists ) continue;
  462. $imgOptions[$i] = 'Masthead image #' . $i;
  463. }
  464. ppO( "{$prefix_}modified_masthead_image", ppUtil::selectParams( $imgOptions ), 'choose one of your uploaded masthead images to display on selected page-types' );
  465.  
  466. ppStopMultiple();
  467.  
  468. // SLIDESHOW options
  469. ppStartMultiple( "$Masthead slideshow options" );
  470. ppO( "{$prefix_}masthead_slideshow_hold_time", 'slider|1|30| seconds|0.5', 'hold time (in seconds) each slideshow image is shown' );
  471. ppO( "{$prefix_}masthead_slideshow_transition_time", 'slider|0|6| seconds|0.2', 'time of transition effect between slideshow images' );
  472. ppO( "{$prefix_}masthead_slideshow_image_order", 'radio|random|play images in random order|sequential|play images in sequential order' );
  473. ppO( "{$prefix_}masthead_slideshow_loop_images", 'radio|true|loop images|false|stop on last image' );
  474. ppO( "{$prefix_}masthead_slideshow_transition_type", ppUtil::radioParams( array(
  475. 'crossfade' => 'cross-fade',
  476. 'fade' => 'fade to bg color then to image',
  477. 'slide' => 'hold then slide horizontally',
  478. 'topslide' => 'hold then slide vertically',
  479. 'steadyslide' => 'steady horizontal slide',
  480. ) ), 'image transition effect' );
  481. ppO( "{$prefix_}masthead_slideshow_bg_color", 'color|optional', 'background color of masthead slideshow' );
  482. ppStopMultiple();
  483. }
  484.  
  485. /* TODO: move this out of this class eventually */
  486. public static function mastheadOptionJs() {
  487. echo <<<HTML
  488. <script type="text/javascript" charset="utf-8">
  489. jQuery(document).ready(function($){
  490. if ( /area=header/.test( window.location.href ) ) {
  491. var prefix = '';
  492. } else {
  493. var prefix = 'mobile_';
  494. }
  495. function ppProcessMastheadDisplayChoice( choice ) {
  496. $('#subgroup-masthead').removeClass('static random slideshow custom off').addClass(choice);
  497.  
  498. // image titles and comments
  499. $('span.masthead-conditional').hide();
  500. $('span.mc-'+choice).show();
  501.  
  502. // add image and custom swf upload show/hide
  503. if ( choice == 'static' ) {
  504. $('#add-masthead-upload').addClass('hidden').hide();
  505. $('#subgroup-masthead .upload-box').not(':first').not('#upload-box-masthead_image1').hide();
  506. $('#subgroup-masthead .upload-box:first').show();
  507. $('#upload-box-'+prefix+'masthead_custom_flash').addClass('hidden').hide();
  508. } else if ( choice == 'random' ) {
  509. $('#subgroup-masthead .upload-box').not('.empty').show();
  510. $('#subgroup-masthead .upload-box.empty:first').show();
  511. $('#upload-box-'+prefix+'masthead_custom_flash').addClass('hidden').hide();
  512. } else if ( choice == 'slideshow' ) {
  513. $('#subgroup-masthead .upload-box').not('.empty').show();
  514. $('#subgroup-masthead .upload-box.empty:first').show();
  515. $('#upload-box-'+prefix+'masthead_custom_flash').addClass('hidden').hide();
  516. } else if ( choice == 'custom' ) {
  517. $('#subgroup-masthead .upload-box').not(':first').hide();
  518. $('#upload-box-'+prefix+'masthead_custom_flash').removeClass('hidden').show();
  519. } else if ( choice == 'off' ) {
  520. $('#subgroup-masthead .upload-box').hide();
  521. }
  522. }
  523. ppProcessMastheadDisplayChoice( $('#'+prefix+'masthead_display-individual-option input[type=radio]:checked').val() );
  524. $('#'+prefix+'masthead_display-individual-option input[type=radio]').click(function(){
  525. ppProcessMastheadDisplayChoice( $(this).val() );
  526. });
  527.  
  528. // classes for masthead modification, used for show/hide ux of complex masthead modified options
  529. var masthead_modify = $('#'+prefix+'masthead_modify-individual-option input[type=radio]:checked').val();
  530. $('#'+prefix+'masthead_display-option-section').addClass('masthead-modify-'+masthead_modify);
  531. $('#'+prefix+'masthead_modify-individual-option input[type=radio]').click(function(){
  532. $('#'+prefix+'masthead_display-option-section')
  533. .removeClass('masthead-modify-true masthead-modify-false')
  534. .addClass( 'masthead-modify-'+$(this).val() );
  535. });
  536. var modify_display = $('#'+prefix+'modified_masthead_display-individual-option input[type=radio]:checked').val();
  537. $('#'+prefix+'masthead_display-option-section table').addClass('modify-display-'+modify_display);
  538. $('#'+prefix+'modified_masthead_display-individual-option input[type=radio]').click(function(){
  539. $('#'+prefix+'masthead_display-option-section table')
  540. .removeClass('modify-display-none modify-display-image')
  541. .addClass( 'modify-display-'+$(this).val() );
  542. });
  543. });
  544. </script>
  545. HTML;
  546. }
  547.  
  548. public static function flushCache() {
  549. self::$usingSubnav = null;
  550. self::$subnavPlacement = null;
  551. }
  552. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement