Index: trunk/phase3/includes/ParserOutput.php |
— | — | @@ -0,0 +1,118 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * @todo document |
| 5 | + * @package MediaWiki |
| 6 | + */ |
| 7 | +class ParserOutput |
| 8 | +{ |
| 9 | + var $mText, # The output text |
| 10 | + $mLanguageLinks, # List of the full text of language links, in the order they appear |
| 11 | + $mCategories, # Map of category names to sort keys |
| 12 | + $mContainsOldMagic, # Boolean variable indicating if the input contained variables like {{CURRENTDAY}} |
| 13 | + $mCacheTime, # Time when this object was generated, or -1 for uncacheable. Used in ParserCache. |
| 14 | + $mVersion, # Compatibility check |
| 15 | + $mTitleText, # title text of the chosen language variant |
| 16 | + $mLinks, # 2-D map of NS/DBK to ID for the links in the document. ID=zero for broken. |
| 17 | + $mTemplates, # 2-D map of NS/DBK to ID for the template references. ID=zero for broken. |
| 18 | + $mImages, # DB keys of the images used, in the array key only |
| 19 | + $mExternalLinks, # External link URLs, in the key only |
| 20 | + $mHTMLtitle, # Display HTML title |
| 21 | + $mSubtitle, # Additional subtitle |
| 22 | + $mNewSection, # Show a new section link? |
| 23 | + $mNoGallery; # No gallery on category page? (__NOGALLERY__) |
| 24 | + |
| 25 | + function ParserOutput( $text = '', $languageLinks = array(), $categoryLinks = array(), |
| 26 | + $containsOldMagic = false, $titletext = '' ) |
| 27 | + { |
| 28 | + $this->mText = $text; |
| 29 | + $this->mLanguageLinks = $languageLinks; |
| 30 | + $this->mCategories = $categoryLinks; |
| 31 | + $this->mContainsOldMagic = $containsOldMagic; |
| 32 | + $this->mCacheTime = ''; |
| 33 | + $this->mVersion = MW_PARSER_VERSION; |
| 34 | + $this->mTitleText = $titletext; |
| 35 | + $this->mLinks = array(); |
| 36 | + $this->mTemplates = array(); |
| 37 | + $this->mImages = array(); |
| 38 | + $this->mExternalLinks = array(); |
| 39 | + $this->mHTMLtitle = "" ; |
| 40 | + $this->mSubtitle = "" ; |
| 41 | + $this->mNewSection = false; |
| 42 | + $this->mNoGallery = false; |
| 43 | + } |
| 44 | + |
| 45 | + function getText() { return $this->mText; } |
| 46 | + function &getLanguageLinks() { return $this->mLanguageLinks; } |
| 47 | + function getCategoryLinks() { return array_keys( $this->mCategories ); } |
| 48 | + function &getCategories() { return $this->mCategories; } |
| 49 | + function getCacheTime() { return $this->mCacheTime; } |
| 50 | + function getTitleText() { return $this->mTitleText; } |
| 51 | + function &getLinks() { return $this->mLinks; } |
| 52 | + function &getTemplates() { return $this->mTemplates; } |
| 53 | + function &getImages() { return $this->mImages; } |
| 54 | + function &getExternalLinks() { return $this->mExternalLinks; } |
| 55 | + function getNoGallery() { return $this->mNoGallery; } |
| 56 | + function getSubtitle() { return $this->mSubtitle; } |
| 57 | + |
| 58 | + function containsOldMagic() { return $this->mContainsOldMagic; } |
| 59 | + function setText( $text ) { return wfSetVar( $this->mText, $text ); } |
| 60 | + function setLanguageLinks( $ll ) { return wfSetVar( $this->mLanguageLinks, $ll ); } |
| 61 | + function setCategoryLinks( $cl ) { return wfSetVar( $this->mCategories, $cl ); } |
| 62 | + function setContainsOldMagic( $com ) { return wfSetVar( $this->mContainsOldMagic, $com ); } |
| 63 | + function setCacheTime( $t ) { return wfSetVar( $this->mCacheTime, $t ); } |
| 64 | + function setTitleText( $t ) { return wfSetVar($this->mTitleText, $t); } |
| 65 | + function setSubtitle( $st ) { return wfSetVar( $this->mSubtitle, $st ); } |
| 66 | + |
| 67 | + function addCategory( $c, $sort ) { $this->mCategories[$c] = $sort; } |
| 68 | + function addImage( $name ) { $this->mImages[$name] = 1; } |
| 69 | + function addLanguageLink( $t ) { $this->mLanguageLinks[] = $t; } |
| 70 | + function addExternalLink( $url ) { $this->mExternalLinks[$url] = 1; } |
| 71 | + |
| 72 | + function setNewSection( $value ) { |
| 73 | + $this->mNewSection = (bool)$value; |
| 74 | + } |
| 75 | + function getNewSection() { |
| 76 | + return (bool)$this->mNewSection; |
| 77 | + } |
| 78 | + |
| 79 | + function addLink( $title, $id = null ) { |
| 80 | + $ns = $title->getNamespace(); |
| 81 | + $dbk = $title->getDBkey(); |
| 82 | + if ( !isset( $this->mLinks[$ns] ) ) { |
| 83 | + $this->mLinks[$ns] = array(); |
| 84 | + } |
| 85 | + if ( is_null( $id ) ) { |
| 86 | + $id = $title->getArticleID(); |
| 87 | + } |
| 88 | + $this->mLinks[$ns][$dbk] = $id; |
| 89 | + } |
| 90 | + |
| 91 | + function addTemplate( $title, $id ) { |
| 92 | + $ns = $title->getNamespace(); |
| 93 | + $dbk = $title->getDBkey(); |
| 94 | + if ( !isset( $this->mTemplates[$ns] ) ) { |
| 95 | + $this->mTemplates[$ns] = array(); |
| 96 | + } |
| 97 | + $this->mTemplates[$ns][$dbk] = $id; |
| 98 | + } |
| 99 | + |
| 100 | + /** |
| 101 | + * Return true if this cached output object predates the global or |
| 102 | + * per-article cache invalidation timestamps, or if it comes from |
| 103 | + * an incompatible older version. |
| 104 | + * |
| 105 | + * @param string $touched the affected article's last touched timestamp |
| 106 | + * @return bool |
| 107 | + * @public |
| 108 | + */ |
| 109 | + function expired( $touched ) { |
| 110 | + global $wgCacheEpoch; |
| 111 | + return $this->getCacheTime() == -1 || // parser says it's uncacheable |
| 112 | + $this->getCacheTime() < $touched || |
| 113 | + $this->getCacheTime() <= $wgCacheEpoch || |
| 114 | + !isset( $this->mVersion ) || |
| 115 | + version_compare( $this->mVersion, MW_PARSER_VERSION, "lt" ); |
| 116 | + } |
| 117 | +} |
| 118 | + |
| 119 | +?> |
Property changes on: trunk/phase3/includes/ParserOutput.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 120 | + native |
Added: svn:keywords |
2 | 121 | + Author Date Id Revision |
Index: trunk/phase3/includes/Parser.php |
— | — | @@ -4692,238 +4692,6 @@ |
4693 | 4693 | |
4694 | 4694 | } |
4695 | 4695 | |
4696 | | -/** |
4697 | | - * @todo document |
4698 | | - * @package MediaWiki |
4699 | | - */ |
4700 | | -class ParserOutput |
4701 | | -{ |
4702 | | - var $mText, # The output text |
4703 | | - $mLanguageLinks, # List of the full text of language links, in the order they appear |
4704 | | - $mCategories, # Map of category names to sort keys |
4705 | | - $mContainsOldMagic, # Boolean variable indicating if the input contained variables like {{CURRENTDAY}} |
4706 | | - $mCacheTime, # Time when this object was generated, or -1 for uncacheable. Used in ParserCache. |
4707 | | - $mVersion, # Compatibility check |
4708 | | - $mTitleText, # title text of the chosen language variant |
4709 | | - $mLinks, # 2-D map of NS/DBK to ID for the links in the document. ID=zero for broken. |
4710 | | - $mTemplates, # 2-D map of NS/DBK to ID for the template references. ID=zero for broken. |
4711 | | - $mImages, # DB keys of the images used, in the array key only |
4712 | | - $mExternalLinks, # External link URLs, in the key only |
4713 | | - $mHTMLtitle, # Display HTML title |
4714 | | - $mSubtitle, # Additional subtitle |
4715 | | - $mNewSection, # Show a new section link? |
4716 | | - $mNoGallery; # No gallery on category page? (__NOGALLERY__) |
4717 | | - |
4718 | | - function ParserOutput( $text = '', $languageLinks = array(), $categoryLinks = array(), |
4719 | | - $containsOldMagic = false, $titletext = '' ) |
4720 | | - { |
4721 | | - $this->mText = $text; |
4722 | | - $this->mLanguageLinks = $languageLinks; |
4723 | | - $this->mCategories = $categoryLinks; |
4724 | | - $this->mContainsOldMagic = $containsOldMagic; |
4725 | | - $this->mCacheTime = ''; |
4726 | | - $this->mVersion = MW_PARSER_VERSION; |
4727 | | - $this->mTitleText = $titletext; |
4728 | | - $this->mLinks = array(); |
4729 | | - $this->mTemplates = array(); |
4730 | | - $this->mImages = array(); |
4731 | | - $this->mExternalLinks = array(); |
4732 | | - $this->mHTMLtitle = "" ; |
4733 | | - $this->mSubtitle = "" ; |
4734 | | - $this->mNewSection = false; |
4735 | | - $this->mNoGallery = false; |
4736 | | - } |
4737 | | - |
4738 | | - function getText() { return $this->mText; } |
4739 | | - function &getLanguageLinks() { return $this->mLanguageLinks; } |
4740 | | - function getCategoryLinks() { return array_keys( $this->mCategories ); } |
4741 | | - function &getCategories() { return $this->mCategories; } |
4742 | | - function getCacheTime() { return $this->mCacheTime; } |
4743 | | - function getTitleText() { return $this->mTitleText; } |
4744 | | - function &getLinks() { return $this->mLinks; } |
4745 | | - function &getTemplates() { return $this->mTemplates; } |
4746 | | - function &getImages() { return $this->mImages; } |
4747 | | - function &getExternalLinks() { return $this->mExternalLinks; } |
4748 | | - function getNoGallery() { return $this->mNoGallery; } |
4749 | | - function getSubtitle() { return $this->mSubtitle; } |
4750 | | - |
4751 | | - function containsOldMagic() { return $this->mContainsOldMagic; } |
4752 | | - function setText( $text ) { return wfSetVar( $this->mText, $text ); } |
4753 | | - function setLanguageLinks( $ll ) { return wfSetVar( $this->mLanguageLinks, $ll ); } |
4754 | | - function setCategoryLinks( $cl ) { return wfSetVar( $this->mCategories, $cl ); } |
4755 | | - function setContainsOldMagic( $com ) { return wfSetVar( $this->mContainsOldMagic, $com ); } |
4756 | | - function setCacheTime( $t ) { return wfSetVar( $this->mCacheTime, $t ); } |
4757 | | - function setTitleText( $t ) { return wfSetVar($this->mTitleText, $t); } |
4758 | | - function setSubtitle( $st ) { return wfSetVar( $this->mSubtitle, $st ); } |
4759 | | - |
4760 | | - function addCategory( $c, $sort ) { $this->mCategories[$c] = $sort; } |
4761 | | - function addImage( $name ) { $this->mImages[$name] = 1; } |
4762 | | - function addLanguageLink( $t ) { $this->mLanguageLinks[] = $t; } |
4763 | | - function addExternalLink( $url ) { $this->mExternalLinks[$url] = 1; } |
4764 | | - |
4765 | | - function setNewSection( $value ) { |
4766 | | - $this->mNewSection = (bool)$value; |
4767 | | - } |
4768 | | - function getNewSection() { |
4769 | | - return (bool)$this->mNewSection; |
4770 | | - } |
4771 | | - |
4772 | | - function addLink( $title, $id = null ) { |
4773 | | - $ns = $title->getNamespace(); |
4774 | | - $dbk = $title->getDBkey(); |
4775 | | - if ( !isset( $this->mLinks[$ns] ) ) { |
4776 | | - $this->mLinks[$ns] = array(); |
4777 | | - } |
4778 | | - if ( is_null( $id ) ) { |
4779 | | - $id = $title->getArticleID(); |
4780 | | - } |
4781 | | - $this->mLinks[$ns][$dbk] = $id; |
4782 | | - } |
4783 | | - |
4784 | | - function addTemplate( $title, $id ) { |
4785 | | - $ns = $title->getNamespace(); |
4786 | | - $dbk = $title->getDBkey(); |
4787 | | - if ( !isset( $this->mTemplates[$ns] ) ) { |
4788 | | - $this->mTemplates[$ns] = array(); |
4789 | | - } |
4790 | | - $this->mTemplates[$ns][$dbk] = $id; |
4791 | | - } |
4792 | | - |
4793 | | - /** |
4794 | | - * Return true if this cached output object predates the global or |
4795 | | - * per-article cache invalidation timestamps, or if it comes from |
4796 | | - * an incompatible older version. |
4797 | | - * |
4798 | | - * @param string $touched the affected article's last touched timestamp |
4799 | | - * @return bool |
4800 | | - * @public |
4801 | | - */ |
4802 | | - function expired( $touched ) { |
4803 | | - global $wgCacheEpoch; |
4804 | | - return $this->getCacheTime() == -1 || // parser says it's uncacheable |
4805 | | - $this->getCacheTime() < $touched || |
4806 | | - $this->getCacheTime() <= $wgCacheEpoch || |
4807 | | - !isset( $this->mVersion ) || |
4808 | | - version_compare( $this->mVersion, MW_PARSER_VERSION, "lt" ); |
4809 | | - } |
4810 | | -} |
4811 | | - |
4812 | | -/** |
4813 | | - * Set options of the Parser |
4814 | | - * @todo document |
4815 | | - * @package MediaWiki |
4816 | | - */ |
4817 | | -class ParserOptions |
4818 | | -{ |
4819 | | - # All variables are supposed to be private in theory, although in practise this is not the case. |
4820 | | - var $mUseTeX; # Use texvc to expand <math> tags |
4821 | | - var $mUseDynamicDates; # Use DateFormatter to format dates |
4822 | | - var $mInterwikiMagic; # Interlanguage links are removed and returned in an array |
4823 | | - var $mAllowExternalImages; # Allow external images inline |
4824 | | - var $mAllowExternalImagesFrom; # If not, any exception? |
4825 | | - var $mSkin; # Reference to the preferred skin |
4826 | | - var $mDateFormat; # Date format index |
4827 | | - var $mEditSection; # Create "edit section" links |
4828 | | - var $mNumberHeadings; # Automatically number headings |
4829 | | - var $mAllowSpecialInclusion; # Allow inclusion of special pages |
4830 | | - var $mTidy; # Ask for tidy cleanup |
4831 | | - var $mInterfaceMessage; # Which lang to call for PLURAL and GRAMMAR |
4832 | | - var $mMaxIncludeSize; # Maximum size of template expansions, in bytes |
4833 | | - var $mRemoveComments; # Remove HTML comments. ONLY APPLIES TO PREPROCESS OPERATIONS |
4834 | | - |
4835 | | - var $mUser; # Stored user object, just used to initialise the skin |
4836 | | - |
4837 | | - function getUseTeX() { return $this->mUseTeX; } |
4838 | | - function getUseDynamicDates() { return $this->mUseDynamicDates; } |
4839 | | - function getInterwikiMagic() { return $this->mInterwikiMagic; } |
4840 | | - function getAllowExternalImages() { return $this->mAllowExternalImages; } |
4841 | | - function getAllowExternalImagesFrom() { return $this->mAllowExternalImagesFrom; } |
4842 | | - function getEditSection() { return $this->mEditSection; } |
4843 | | - function getNumberHeadings() { return $this->mNumberHeadings; } |
4844 | | - function getAllowSpecialInclusion() { return $this->mAllowSpecialInclusion; } |
4845 | | - function getTidy() { return $this->mTidy; } |
4846 | | - function getInterfaceMessage() { return $this->mInterfaceMessage; } |
4847 | | - function getMaxIncludeSize() { return $this->mMaxIncludeSize; } |
4848 | | - function getRemoveComments() { return $this->mRemoveComments; } |
4849 | | - |
4850 | | - function &getSkin() { |
4851 | | - if ( !isset( $this->mSkin ) ) { |
4852 | | - $this->mSkin = $this->mUser->getSkin(); |
4853 | | - } |
4854 | | - return $this->mSkin; |
4855 | | - } |
4856 | | - |
4857 | | - function getDateFormat() { |
4858 | | - if ( !isset( $this->mDateFormat ) ) { |
4859 | | - $this->mDateFormat = $this->mUser->getDatePreference(); |
4860 | | - } |
4861 | | - return $this->mDateFormat; |
4862 | | - } |
4863 | | - |
4864 | | - function setUseTeX( $x ) { return wfSetVar( $this->mUseTeX, $x ); } |
4865 | | - function setUseDynamicDates( $x ) { return wfSetVar( $this->mUseDynamicDates, $x ); } |
4866 | | - function setInterwikiMagic( $x ) { return wfSetVar( $this->mInterwikiMagic, $x ); } |
4867 | | - function setAllowExternalImages( $x ) { return wfSetVar( $this->mAllowExternalImages, $x ); } |
4868 | | - function setAllowExternalImagesFrom( $x ) { return wfSetVar( $this->mAllowExternalImagesFrom, $x ); } |
4869 | | - function setDateFormat( $x ) { return wfSetVar( $this->mDateFormat, $x ); } |
4870 | | - function setEditSection( $x ) { return wfSetVar( $this->mEditSection, $x ); } |
4871 | | - function setNumberHeadings( $x ) { return wfSetVar( $this->mNumberHeadings, $x ); } |
4872 | | - function setAllowSpecialInclusion( $x ) { return wfSetVar( $this->mAllowSpecialInclusion, $x ); } |
4873 | | - function setTidy( $x ) { return wfSetVar( $this->mTidy, $x); } |
4874 | | - function setSkin( $x ) { $this->mSkin = $x; } |
4875 | | - function setInterfaceMessage( $x ) { return wfSetVar( $this->mInterfaceMessage, $x); } |
4876 | | - function setMaxIncludeSize( $x ) { return wfSetVar( $this->mMaxIncludeSize, $x ); } |
4877 | | - function setRemoveComments( $x ) { return wfSetVar( $this->mRemoveComments, $x ); } |
4878 | | - |
4879 | | - function ParserOptions( $user = null ) { |
4880 | | - $this->initialiseFromUser( $user ); |
4881 | | - } |
4882 | | - |
4883 | | - /** |
4884 | | - * Get parser options |
4885 | | - * @static |
4886 | | - */ |
4887 | | - static function newFromUser( $user ) { |
4888 | | - return new ParserOptions( $user ); |
4889 | | - } |
4890 | | - |
4891 | | - /** Get user options */ |
4892 | | - function initialiseFromUser( $userInput ) { |
4893 | | - global $wgUseTeX, $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages; |
4894 | | - global $wgAllowExternalImagesFrom, $wgAllowSpecialInclusion, $wgMaxArticleSize; |
4895 | | - $fname = 'ParserOptions::initialiseFromUser'; |
4896 | | - wfProfileIn( $fname ); |
4897 | | - if ( !$userInput ) { |
4898 | | - global $wgUser; |
4899 | | - if ( isset( $wgUser ) ) { |
4900 | | - $user = $wgUser; |
4901 | | - } else { |
4902 | | - $user = new User; |
4903 | | - } |
4904 | | - } else { |
4905 | | - $user =& $userInput; |
4906 | | - } |
4907 | | - |
4908 | | - $this->mUser = $user; |
4909 | | - |
4910 | | - $this->mUseTeX = $wgUseTeX; |
4911 | | - $this->mUseDynamicDates = $wgUseDynamicDates; |
4912 | | - $this->mInterwikiMagic = $wgInterwikiMagic; |
4913 | | - $this->mAllowExternalImages = $wgAllowExternalImages; |
4914 | | - $this->mAllowExternalImagesFrom = $wgAllowExternalImagesFrom; |
4915 | | - $this->mSkin = null; # Deferred |
4916 | | - $this->mDateFormat = null; # Deferred |
4917 | | - $this->mEditSection = true; |
4918 | | - $this->mNumberHeadings = $user->getOption( 'numberheadings' ); |
4919 | | - $this->mAllowSpecialInclusion = $wgAllowSpecialInclusion; |
4920 | | - $this->mTidy = false; |
4921 | | - $this->mInterfaceMessage = false; |
4922 | | - $this->mMaxIncludeSize = $wgMaxArticleSize * 1024; |
4923 | | - $this->mRemoveComments = true; |
4924 | | - wfProfileOut( $fname ); |
4925 | | - } |
4926 | | -} |
4927 | | - |
4928 | 4696 | class OnlyIncludeReplacer { |
4929 | 4697 | var $output = ''; |
4930 | 4698 | |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -122,8 +122,8 @@ |
123 | 123 | 'ReverseChronologicalPager' => 'includes/Pager.php', |
124 | 124 | 'TablePager' => 'includes/Pager.php', |
125 | 125 | 'Parser' => 'includes/Parser.php', |
126 | | - 'ParserOutput' => 'includes/Parser.php', |
127 | | - 'ParserOptions' => 'includes/Parser.php', |
| 126 | + 'ParserOutput' => 'includes/ParserOutput.php', |
| 127 | + 'ParserOptions' => 'includes/ParserOptions.php', |
128 | 128 | 'ParserCache' => 'includes/ParserCache.php', |
129 | 129 | 'ProfilerSimple' => 'includes/ProfilerSimple.php', |
130 | 130 | 'ProfilerSimpleUDP' => 'includes/ProfilerSimpleUDP.php', |
Index: trunk/phase3/includes/ParserOptions.php |
— | — | @@ -0,0 +1,119 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Set options of the Parser |
| 6 | + * @todo document |
| 7 | + * @package MediaWiki |
| 8 | + */ |
| 9 | +class ParserOptions |
| 10 | +{ |
| 11 | + # All variables are supposed to be private in theory, although in practise this is not the case. |
| 12 | + var $mUseTeX; # Use texvc to expand <math> tags |
| 13 | + var $mUseDynamicDates; # Use DateFormatter to format dates |
| 14 | + var $mInterwikiMagic; # Interlanguage links are removed and returned in an array |
| 15 | + var $mAllowExternalImages; # Allow external images inline |
| 16 | + var $mAllowExternalImagesFrom; # If not, any exception? |
| 17 | + var $mSkin; # Reference to the preferred skin |
| 18 | + var $mDateFormat; # Date format index |
| 19 | + var $mEditSection; # Create "edit section" links |
| 20 | + var $mNumberHeadings; # Automatically number headings |
| 21 | + var $mAllowSpecialInclusion; # Allow inclusion of special pages |
| 22 | + var $mTidy; # Ask for tidy cleanup |
| 23 | + var $mInterfaceMessage; # Which lang to call for PLURAL and GRAMMAR |
| 24 | + var $mMaxIncludeSize; # Maximum size of template expansions, in bytes |
| 25 | + var $mRemoveComments; # Remove HTML comments. ONLY APPLIES TO PREPROCESS OPERATIONS |
| 26 | + |
| 27 | + var $mUser; # Stored user object, just used to initialise the skin |
| 28 | + |
| 29 | + function getUseTeX() { return $this->mUseTeX; } |
| 30 | + function getUseDynamicDates() { return $this->mUseDynamicDates; } |
| 31 | + function getInterwikiMagic() { return $this->mInterwikiMagic; } |
| 32 | + function getAllowExternalImages() { return $this->mAllowExternalImages; } |
| 33 | + function getAllowExternalImagesFrom() { return $this->mAllowExternalImagesFrom; } |
| 34 | + function getEditSection() { return $this->mEditSection; } |
| 35 | + function getNumberHeadings() { return $this->mNumberHeadings; } |
| 36 | + function getAllowSpecialInclusion() { return $this->mAllowSpecialInclusion; } |
| 37 | + function getTidy() { return $this->mTidy; } |
| 38 | + function getInterfaceMessage() { return $this->mInterfaceMessage; } |
| 39 | + function getMaxIncludeSize() { return $this->mMaxIncludeSize; } |
| 40 | + function getRemoveComments() { return $this->mRemoveComments; } |
| 41 | + |
| 42 | + function &getSkin() { |
| 43 | + if ( !isset( $this->mSkin ) ) { |
| 44 | + $this->mSkin = $this->mUser->getSkin(); |
| 45 | + } |
| 46 | + return $this->mSkin; |
| 47 | + } |
| 48 | + |
| 49 | + function getDateFormat() { |
| 50 | + if ( !isset( $this->mDateFormat ) ) { |
| 51 | + $this->mDateFormat = $this->mUser->getDatePreference(); |
| 52 | + } |
| 53 | + return $this->mDateFormat; |
| 54 | + } |
| 55 | + |
| 56 | + function setUseTeX( $x ) { return wfSetVar( $this->mUseTeX, $x ); } |
| 57 | + function setUseDynamicDates( $x ) { return wfSetVar( $this->mUseDynamicDates, $x ); } |
| 58 | + function setInterwikiMagic( $x ) { return wfSetVar( $this->mInterwikiMagic, $x ); } |
| 59 | + function setAllowExternalImages( $x ) { return wfSetVar( $this->mAllowExternalImages, $x ); } |
| 60 | + function setAllowExternalImagesFrom( $x ) { return wfSetVar( $this->mAllowExternalImagesFrom, $x ); } |
| 61 | + function setDateFormat( $x ) { return wfSetVar( $this->mDateFormat, $x ); } |
| 62 | + function setEditSection( $x ) { return wfSetVar( $this->mEditSection, $x ); } |
| 63 | + function setNumberHeadings( $x ) { return wfSetVar( $this->mNumberHeadings, $x ); } |
| 64 | + function setAllowSpecialInclusion( $x ) { return wfSetVar( $this->mAllowSpecialInclusion, $x ); } |
| 65 | + function setTidy( $x ) { return wfSetVar( $this->mTidy, $x); } |
| 66 | + function setSkin( $x ) { $this->mSkin = $x; } |
| 67 | + function setInterfaceMessage( $x ) { return wfSetVar( $this->mInterfaceMessage, $x); } |
| 68 | + function setMaxIncludeSize( $x ) { return wfSetVar( $this->mMaxIncludeSize, $x ); } |
| 69 | + function setRemoveComments( $x ) { return wfSetVar( $this->mRemoveComments, $x ); } |
| 70 | + |
| 71 | + function ParserOptions( $user = null ) { |
| 72 | + $this->initialiseFromUser( $user ); |
| 73 | + } |
| 74 | + |
| 75 | + /** |
| 76 | + * Get parser options |
| 77 | + * @static |
| 78 | + */ |
| 79 | + static function newFromUser( $user ) { |
| 80 | + return new ParserOptions( $user ); |
| 81 | + } |
| 82 | + |
| 83 | + /** Get user options */ |
| 84 | + function initialiseFromUser( $userInput ) { |
| 85 | + global $wgUseTeX, $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages; |
| 86 | + global $wgAllowExternalImagesFrom, $wgAllowSpecialInclusion, $wgMaxArticleSize; |
| 87 | + $fname = 'ParserOptions::initialiseFromUser'; |
| 88 | + wfProfileIn( $fname ); |
| 89 | + if ( !$userInput ) { |
| 90 | + global $wgUser; |
| 91 | + if ( isset( $wgUser ) ) { |
| 92 | + $user = $wgUser; |
| 93 | + } else { |
| 94 | + $user = new User; |
| 95 | + } |
| 96 | + } else { |
| 97 | + $user =& $userInput; |
| 98 | + } |
| 99 | + |
| 100 | + $this->mUser = $user; |
| 101 | + |
| 102 | + $this->mUseTeX = $wgUseTeX; |
| 103 | + $this->mUseDynamicDates = $wgUseDynamicDates; |
| 104 | + $this->mInterwikiMagic = $wgInterwikiMagic; |
| 105 | + $this->mAllowExternalImages = $wgAllowExternalImages; |
| 106 | + $this->mAllowExternalImagesFrom = $wgAllowExternalImagesFrom; |
| 107 | + $this->mSkin = null; # Deferred |
| 108 | + $this->mDateFormat = null; # Deferred |
| 109 | + $this->mEditSection = true; |
| 110 | + $this->mNumberHeadings = $user->getOption( 'numberheadings' ); |
| 111 | + $this->mAllowSpecialInclusion = $wgAllowSpecialInclusion; |
| 112 | + $this->mTidy = false; |
| 113 | + $this->mInterfaceMessage = false; |
| 114 | + $this->mMaxIncludeSize = $wgMaxArticleSize * 1024; |
| 115 | + $this->mRemoveComments = true; |
| 116 | + wfProfileOut( $fname ); |
| 117 | + } |
| 118 | +} |
| 119 | + |
| 120 | +?> |
Property changes on: trunk/phase3/includes/ParserOptions.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 121 | + native |
Added: svn:keywords |
2 | 122 | + Author Date Id Revision |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -122,6 +122,7 @@ |
123 | 123 | * (bug 8688) Handle underscores/spaces in Special:Blockip and Special:Ipblocklist |
124 | 124 | in a consistent manner |
125 | 125 | * (bug 8701) Check database lock status when blocking/unblocking users |
| 126 | +* ParserOptions and ParserOutput classes are now in their own files. |
126 | 127 | |
127 | 128 | == Languages updated == |
128 | 129 | |