Changeset 1288258
- Timestamp:
- 11/17/2015 09:13:06 PM (10 years ago)
- Location:
- digital-publishing
- Files:
-
- 2 edited
-
tags/2.0.10/publish-templates/article.php (modified) (1 diff)
-
trunk/publish-templates/article.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
digital-publishing/tags/2.0.10/publish-templates/article.php
r1287320 r1288258 6 6 7 7 <?php 8 // If bundling set the file path to be relative to the article 8 /* == File path for publish-templates located inside the plugin folder: == */ 9 $filePath = plugins_url( DPSFA_DIR_NAME . '/publish-templates/HTMLResources/' ); 10 // If you move the publish-templates folder into your template directory then uncomment the below line and comment out the line above. 11 // $filePath = get_bloginfo('template_directory') . '/publish-templates/HTMLResources/'; 12 9 13 if( isset($_GET["bundlr"]) ) { 10 $filePath = 'HTMLResources/'; 14 // This could be used for changing links to navto:// links 11 15 $urlPath = 'navto://'; 12 } else {13 $filePath = plugins_url( DPSFA_DIR_NAME . '/publish-templates/HTMLResources/' );14 // If you move the publish-templates folder into your template directory then uncomment the below line and comment out the line above.15 // $filePath = get_bloginfo('template_directory') . '/publish-templates/HTMLResources/';16 16 } 17 17 18 18 /* 19 20 WP Filter to include additional files 21 Should return an array( "file path relative to article" => "filepath relative to server" ); 22 This filter also gives you the entity (article) object so you can include additional files 23 based on certain criteria of the entity's metadata 24 19 == WP Filter to include additional files == 20 You can add additional files to the article using the filter below. You can add file two ways: 21 22 1. Automatic: Specify full url to file (array of images) 23 Specifying the full url will create the necessary folder scructure in the article and download the external file 24 Folder struture for external resources: ARTICLE > sanitized hostname > path > file 25 Example: array('http://www.domain.com/wp-content/themes/theme/file.jpg') will put that file in the article as: domaincom/wp-content/themes/theme/file.jpg 26 27 2. Manual: Specify the full paths array( "file path relative in article" => "filepath relative to server (or url)" ) 28 You can have control over where the file is placed in the article and where to pull it from the server 29 Example: array( array('slideshow/image/file.jpg' => 'www/wp-content/themes/theme/file.jpg') ) will put that file in the article as: domaincom/wp-content/themes/theme/file.jpg 25 30 */ 26 31 27 32 add_filter('dpsfa_bundle_article', function($entity){ 28 $path = pathinfo($entity->template); 29 return array( 30 "HTMLResources/fonts/glyphicons-halflings-regular.eot" => $path['dirname'] . '/HTMLResources/fonts/glyphicons-halflings-regular.eot', 31 "HTMLResources/fonts/glyphicons-halflings-regular.svg" => $path['dirname'] . '/HTMLResources/fonts/glyphicons-halflings-regular.svg', 32 "HTMLResources/fonts/glyphicons-halflings-regular.ttf" => $path['dirname'] . '/HTMLResources/fonts/glyphicons-halflings-regular.ttf', 33 "HTMLResources/fonts/glyphicons-halflings-regular.woff" => $path['dirname'] . '/HTMLResources/fonts/glyphicons-halflings-regular.woff', 34 "HTMLResources/fonts/glyphicons-halflings-regular.woff2" => $path['dirname'] . '/HTMLResources/fonts/glyphicons-halflings-regular.woff2', 35 ); 33 // $entity will contain all of the info of the article (metadata / template / etc.) 34 $filePath = plugins_url( DPSFA_DIR_NAME . '/publish-templates/HTMLResources/' ); // If inside plugin folder 35 // $filePath = get_bloginfo('template_directory') . '/publish-templates/HTMLResources/'; // If inside theme folder 36 37 return array( 38 $filePath . 'fonts/glyphicons-halflings-regular.eot', 39 $filePath . 'fonts/glyphicons-halflings-regular.svg', 40 $filePath . 'fonts/glyphicons-halflings-regular.ttf', 41 $filePath . 'fonts/glyphicons-halflings-regular.woff', 42 $filePath . 'fonts/glyphicons-halflings-regular.woff2', 43 ); 36 44 }); 37 45 -
digital-publishing/trunk/publish-templates/article.php
r1256996 r1288258 6 6 7 7 <?php 8 // If bundling set the file path to be relative to the article 8 /* == File path for publish-templates located inside the plugin folder: == */ 9 $filePath = plugins_url( DPSFA_DIR_NAME . '/publish-templates/HTMLResources/' ); 10 // If you move the publish-templates folder into your template directory then uncomment the below line and comment out the line above. 11 // $filePath = get_bloginfo('template_directory') . '/publish-templates/HTMLResources/'; 12 9 13 if( isset($_GET["bundlr"]) ) { 10 $filePath = 'HTMLResources/'; 14 // This could be used for changing links to navto:// links 11 15 $urlPath = 'navto://'; 12 } else {13 $filePath = plugins_url( DPSFA_DIR_NAME . '/publish-templates/HTMLResources/' );14 // If you move the publish-templates folder into your template directory then uncomment the below line and comment out the line above.15 // $filePath = get_bloginfo('template_directory') . '/publish-templates/HTMLResources/';16 16 } 17 17 18 18 /* 19 20 WP Filter to include additional files 21 Should return an array( "file path relative to article" => "filepath relative to server" ); 22 This filter also gives you the entity (article) object so you can include additional files 23 based on certain criteria of the entity's metadata 24 19 == WP Filter to include additional files == 20 You can add additional files to the article using the filter below. You can add file two ways: 21 22 1. Automatic: Specify full url to file (array of images) 23 Specifying the full url will create the necessary folder scructure in the article and download the external file 24 Folder struture for external resources: ARTICLE > sanitized hostname > path > file 25 Example: array('http://www.domain.com/wp-content/themes/theme/file.jpg') will put that file in the article as: domaincom/wp-content/themes/theme/file.jpg 26 27 2. Manual: Specify the full paths array( "file path relative in article" => "filepath relative to server (or url)" ) 28 You can have control over where the file is placed in the article and where to pull it from the server 29 Example: array( array('slideshow/image/file.jpg' => 'www/wp-content/themes/theme/file.jpg') ) will put that file in the article as: domaincom/wp-content/themes/theme/file.jpg 25 30 */ 26 31 27 32 add_filter('dpsfa_bundle_article', function($entity){ 28 $path = pathinfo($entity->template); 29 return array( 30 "HTMLResources/fonts/glyphicons-halflings-regular.eot" => $path['dirname'] . '/HTMLResources/fonts/glyphicons-halflings-regular.eot', 31 "HTMLResources/fonts/glyphicons-halflings-regular.svg" => $path['dirname'] . '/HTMLResources/fonts/glyphicons-halflings-regular.svg', 32 "HTMLResources/fonts/glyphicons-halflings-regular.ttf" => $path['dirname'] . '/HTMLResources/fonts/glyphicons-halflings-regular.ttf', 33 "HTMLResources/fonts/glyphicons-halflings-regular.woff" => $path['dirname'] . '/HTMLResources/fonts/glyphicons-halflings-regular.woff', 34 "HTMLResources/fonts/glyphicons-halflings-regular.woff2" => $path['dirname'] . '/HTMLResources/fonts/glyphicons-halflings-regular.woff2', 35 ); 33 // $entity will contain all of the info of the article (metadata / template / etc.) 34 $filePath = plugins_url( DPSFA_DIR_NAME . '/publish-templates/HTMLResources/' ); // If inside plugin folder 35 // $filePath = get_bloginfo('template_directory') . '/publish-templates/HTMLResources/'; // If inside theme folder 36 37 return array( 38 $filePath . 'fonts/glyphicons-halflings-regular.eot', 39 $filePath . 'fonts/glyphicons-halflings-regular.svg', 40 $filePath . 'fonts/glyphicons-halflings-regular.ttf', 41 $filePath . 'fonts/glyphicons-halflings-regular.woff', 42 $filePath . 'fonts/glyphicons-halflings-regular.woff2', 43 ); 36 44 }); 37 45
Note: See TracChangeset
for help on using the changeset viewer.