مودول:ProtectionLevels

من ويكيپيديا

الاستخدام[بدل لكود]

لمعرفة إذا كانت صفحة أو قالب يخضع لحماية أم لا :

{{#استدعاء:ProtectionLevels|main}}

أمثلة[بدل لكود]

توصيف يظهر
<code>{{#invoke:ProtectionLevels|main}}</code> 

<code>{{#invoke:ProtectionLevels|main|قالب:في الأخبار}}</code> 

{{#invoke:ProtectionLevels|main|وحدة:wikidata2}} 

{{#invoke:ProtectionLevels|main|ويكيبيديا:ملعب}} 

{{#invoke:ProtectionLevels|main|شسيشسي}} 



--[[

{{#invoke:ProtectionLevels|main}}

{{#invoke:ProtectionLevels|main|الصفحة_الرئيسية}}

--]]

local p = {}

function p.main(frame)
	local page
	local titleArg = frame.args[1] or frame:getParent().args[1]
	if titleArg then
		page = mw.title.new(titleArg)
	else
		page = mw.title.getCurrentTitle()
	end
	--mw.log( "p.main(frame) :page "  .. page.prefixedText )
	--mw.log( mw.dumpObject(page.protectionLevels)  )
	local editProt = page.protectionLevels.edit and page.protectionLevels.edit[1]
	local moveProt = page.protectionLevels.move and page.protectionLevels.move[1]
	if editProt then 
			return "1"
		end
	
	return ""
end

return p