From db4d4a1b34678f09af35ab70e02405c4097101de Mon Sep 17 00:00:00 2001
From: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
Date: Thu, 20 Jun 2019 14:59:02 -0700
Subject: [PATCH] fix: converted single to triple backticks12 (#36239)
---
.../machine-learning/random-forest/index.md | 65 +--
.../index.md | 27 +-
.../index.md | 9 +-
.../index.md | 70 +--
.../index.md | 31 +-
.../index.md | 10 +-
.../counting/combinations/index.md | 9 +-
guide/arabic/mathematics/index.md | 49 +-
.../mathematics/intro-to-logarithms/index.md | 13 +-
.../mean-median-mode-and-range/index.md | 83 ++--
.../index.md | 12 +-
.../index.md | 71 +--
.../how-to-redirect-a-web-page/index.md | 5 +-
.../html-and-css-cheat-sheet/index.md | 6 +-
.../miscellaneous/learn-about-jsonp/index.md | 14 +-
.../testing-with-chaijs/index.md | 14 +-
.../index.md | 19 +-
.../index.md | 194 ++++----
guide/arabic/nodejs/buffer/index.md | 70 +--
guide/arabic/nodejs/event-emitters/index.md | 58 ++-
guide/arabic/nodejs/express/index.md | 434 ++++++++++--------
guide/arabic/nodejs/file-system/index.md | 14 +-
guide/arabic/nodejs/http/index.md | 18 +-
guide/arabic/nodejs/index.md | 38 +-
guide/arabic/nodejs/npm/index.md | 324 +++++++------
guide/arabic/nodejs/process/index.md | 76 +--
guide/arabic/nodejs/streams/index.md | 143 +++---
guide/arabic/php/ajax/index.md | 88 ++--
guide/arabic/php/array/index.md | 30 +-
guide/arabic/php/arrays/index.md | 21 +-
.../arabic/php/arrays/sorting-arrays/index.md | 156 ++++---
guide/arabic/php/basic-syntax/index.md | 27 +-
guide/arabic/php/class-inheritance/index.md | 163 +++----
guide/arabic/php/class/index.md | 45 +-
guide/arabic/php/conditionals/index.md | 45 +-
guide/arabic/php/constants/index.md | 14 +-
.../php/functions/die-and-exit/index.md | 14 +-
.../php/functions/echo-and-print/index.md | 28 +-
guide/arabic/php/functions/index.md | 47 +-
guide/arabic/php/functions/time/index.md | 12 +-
guide/arabic/php/hello-world/index.md | 39 +-
guide/arabic/php/index.md | 15 +-
guide/arabic/php/loop/index.md | 167 +++----
guide/arabic/php/loops/for-loop/index.md | 29 +-
guide/arabic/php/loops/while-loop/index.md | 18 +-
.../php/object-oriented-programming/index.md | 159 ++++---
guide/arabic/php/php-array/index.md | 47 +-
guide/arabic/php/php-cookies/index.md | 109 ++---
guide/arabic/php/php-data-types/index.md | 54 ++-
guide/arabic/php/php-echo-print/index.md | 74 +--
guide/arabic/php/php-form-handling/index.md | 95 ++--
guide/arabic/php/php-form-required/index.md | 126 ++---
guide/arabic/php/php-forms-url-email/index.md | 134 +++---
guide/arabic/php/php-functions/index.md | 32 +-
guide/arabic/php/php-install/index.md | 5 +-
guide/arabic/php/php-strings/index.md | 35 +-
guide/arabic/php/php-switch/index.md | 62 +--
guide/arabic/php/php-syntax/index.md | 87 ++--
guide/arabic/php/php-tags/index.md | 19 +-
guide/arabic/php/php-variables/index.md | 15 +-
.../polymorphism-abstract-interface/index.md | 145 +++---
guide/arabic/php/pp-sessions/index.md | 149 +++---
.../cross-site-request-forgery/index.md | 37 +-
.../security/cross-site-scripting/index.md | 48 +-
.../security/local-file-inclusion/index.md | 11 +-
.../security/remote-file-inclusion/index.md | 11 +-
.../php/security/session-hijacking/index.md | 57 +--
.../session-identifier-acquirement/index.md | 57 +--
.../php/security/sql-injection/index.md | 80 ++--
guide/arabic/php/sessions/index.md | 34 +-
guide/arabic/php/switch-statement/index.md | 43 +-
guide/arabic/php/switch-statements/index.md | 23 +-
guide/arabic/php/syntax/index.md | 27 +-
.../arabic/php/variables/data-types/index.md | 69 +--
guide/arabic/php/variables/index.md | 48 +-
75 files changed, 2521 insertions(+), 2205 deletions(-)
diff --git a/guide/arabic/machine-learning/random-forest/index.md b/guide/arabic/machine-learning/random-forest/index.md
index 8370213bde..15befac6c9 100644
--- a/guide/arabic/machine-learning/random-forest/index.md
+++ b/guide/arabic/machine-learning/random-forest/index.md
@@ -18,38 +18,39 @@ localeTitle: غابة عشوائية
في هذه المسابقة ، يتم منحنا قائمة بأحداث التصادم وخصائصها. سوف نتوقع بعد ذلك ما إذا كان هناك إنحلال τ → 3μ حدث في هذا التصادم. هذا τ → 3μ يفترض في الوقت الحاضر من قبل العلماء ألا يحدث ، وكان الهدف من هذه المسابقة هو اكتشاف τ → 3μ يحدث بشكل متكرر أكثر مما يستطيع العلماء فهمه. كان التحدي هنا هو تصميم مشكلة تعلم آلي لشيء لم يلاحظه أحد من قبل. طور العلماء في CERN التصاميم التالية لتحقيق الهدف. https://www.kaggle.com/c/flavours-of-physics/data
- `#Data Cleaning
- import pandas as pd
- data_test = pd.read_csv("test.csv")
- data_train = pd.read_csv("training.csv")
- data_train = data_train.drop('min_ANNmuon',1)
- data_train = data_train.drop('production',1)
- data_train = data_train.drop('mass',1)
-
- #Cleaned data
- Y = data_train['signal']
- X = data_train.drop('signal',1)
-
- #adaboost
- from sklearn.ensemble import AdaBoostClassifier
- from sklearn.tree import DecisionTreeClassifier
- seed = 9001 #this ones over 9000!!!
- boosted_tree = AdaBoostClassifier(DecisionTreeClassifier(max_depth=1), algorithm="SAMME",
- n_estimators=50, random_state = seed)
- model = boosted_tree.fit(X, Y)
-
- predictions = model.predict(data_test)
- print(predictions)
- #Note we can't really validate this data since we don't have an array of "right answers"
-
- #stochastic gradient boosting
- from sklearn.ensemble import GradientBoostingClassifier
- gradient_boosted_tree = GradientBoostingClassifier(n_estimators=50, random_state=seed)
- model2 = gradient_boosted_tree.fit(X,Y)
-
- predictions2 = model2.predict(data_test)
- print(predictions2)
-`
+```python
+#Data Cleaning
+import pandas as pd
+data_test = pd.read_csv("test.csv")
+data_train = pd.read_csv("training.csv")
+data_train = data_train.drop('min_ANNmuon',1)
+data_train = data_train.drop('production',1)
+data_train = data_train.drop('mass',1)
+
+#Cleaned data
+Y = data_train['signal']
+X = data_train.drop('signal',1)
+
+#adaboost
+from sklearn.ensemble import AdaBoostClassifier
+from sklearn.tree import DecisionTreeClassifier
+seed = 9001 #this ones over 9000!!!
+boosted_tree = AdaBoostClassifier(DecisionTreeClassifier(max_depth=1), algorithm="SAMME",
+ n_estimators=50, random_state = seed)
+model = boosted_tree.fit(X, Y)
+
+predictions = model.predict(data_test)
+print(predictions)
+#Note we can't really validate this data since we don't have an array of "right answers"
+
+#stochastic gradient boosting
+from sklearn.ensemble import GradientBoostingClassifier
+gradient_boosted_tree = GradientBoostingClassifier(n_estimators=50, random_state=seed)
+model2 = gradient_boosted_tree.fit(X,Y)
+
+predictions2 = model2.predict(data_test)
+print(predictions2)
+```
#### معلومات اكثر:
diff --git a/guide/arabic/mathematics/converting-between-radians-and-degrees/index.md b/guide/arabic/mathematics/converting-between-radians-and-degrees/index.md
index a4bbc2cf95..3bdb6d9d84 100644
--- a/guide/arabic/mathematics/converting-between-radians-and-degrees/index.md
+++ b/guide/arabic/mathematics/converting-between-radians-and-degrees/index.md
@@ -8,23 +8,26 @@ localeTitle: تحويل بين راديان ودرجات
يمكن استخدام الصيغ التالية للتحويل بين الراديان والدرجات:
- `r = d * (π / 180)
-
- d = r * (180 / π)
-
- where r is the angle in radians and d is the angle in degrees.
-`
+```
+r = d * (π / 180)
+
+d = r * (180 / π)
+
+where r is the angle in radians and d is the angle in degrees.
+```
### أمثلة
تحويل 2π / 3 راديان إلى درجات:
- `2π/3 * 180/π = 360π/3π = 360/3 = 120 degrees
-`
+```
+2π/3 * 180/π = 360π/3π = 360/3 = 120 degrees
+```
تحويل 30 درجة إلى راديان:
- `30 * π/180 = 30π/180 = π/6 or (1/6)π radians
-
- Note: Radians are usually expressed in terms of π instead of a rounded decimal as this form represents the actual value rather than an approximation.
-`
\ No newline at end of file
+```
+30 * π/180 = 30π/180 = π/6 or (1/6)π radians
+
+Note: Radians are usually expressed in terms of π instead of a rounded decimal as this form represents the actual value rather than an approximation.
+```
\ No newline at end of file
diff --git a/guide/arabic/mathematics/converting-directly-from-binary-to-hexadecimal/index.md b/guide/arabic/mathematics/converting-directly-from-binary-to-hexadecimal/index.md
index c271454d4c..681947cfa8 100644
--- a/guide/arabic/mathematics/converting-directly-from-binary-to-hexadecimal/index.md
+++ b/guide/arabic/mathematics/converting-directly-from-binary-to-hexadecimal/index.md
@@ -22,10 +22,11 @@ localeTitle: تحويل مباشرة من ثنائي إلى سداسي عشري
تحويل الرقم الثنائي 01101000000001 إلى رقم سداسي عشري.
- `1. 01101000000001 => 01|1010|0000|0001
- 2. 01|1010|0000|0001 => 0001|1010|0000|0001
- 3. 0001|1010|0000|0001 => 1A01
-`
+```
+1. 01101000000001 => 01|1010|0000|0001
+2. 01|1010|0000|0001 => 0001|1010|0000|0001
+3. 0001|1010|0000|0001 => 1A01
+```
#### معلومات اكثر:
diff --git a/guide/arabic/mathematics/converting-from-decimal-to-binary/index.md b/guide/arabic/mathematics/converting-from-decimal-to-binary/index.md
index 726319cf14..cf340a1d20 100644
--- a/guide/arabic/mathematics/converting-from-decimal-to-binary/index.md
+++ b/guide/arabic/mathematics/converting-from-decimal-to-binary/index.md
@@ -14,40 +14,42 @@ localeTitle: تحويل من عشري إلى ثنائي
تحويل الرقم العشري 30 إلى ثنائي.
- `30 / 2 = 15 r 0
- 15 / 2 = 7 r 1
- 7 / 2 = 3 r 1
- 3 / 2 = 1 r 1
- 1 / 2 = 0 r 1
-
- Writing out the remainders bottom to top gives you the bit pattern:
-
- 11110
-
- Checking your answer by converting the binary number back to decimal:
-
- (1*2^4)+(1*2^3)+(1*2^2)+(1*2^1)+(0*2^0) = 30
-
- So your answer is correct.
-`
+```
+30 / 2 = 15 r 0
+15 / 2 = 7 r 1
+7 / 2 = 3 r 1
+3 / 2 = 1 r 1
+1 / 2 = 0 r 1
+
+Writing out the remainders bottom to top gives you the bit pattern:
+
+11110
+
+Checking your answer by converting the binary number back to decimal:
+
+(1*2^4)+(1*2^3)+(1*2^2)+(1*2^1)+(0*2^0) = 30
+
+So your answer is correct.
+```
تحويل الرقم العشري 116 إلى ثنائي.
- `116 / 2 = 58 r 0
- 58 / 2 = 29 r 0
- 29 / 2 = 14 r 1
- 14 / 2 = 7 r 0
- 7 / 2 = 3 r 1
- 3 / 2 = 1 r 1
- 1 / 2 = 0 r 1
-
- Writing out the remainders bottom to top gives you the bit pattern:
-
- 1110100
-
- Checking your answer by converting the binary number back to decimal:
-
- (1*2^6)+(1*2^5)+(1*2^4)+(0*2^3)+(1*2^2)+(0*2^1)+(0*2^0) = 116
-
- So your answer is correct.
-`
\ No newline at end of file
+```
+116 / 2 = 58 r 0
+58 / 2 = 29 r 0
+29 / 2 = 14 r 1
+14 / 2 = 7 r 0
+7 / 2 = 3 r 1
+3 / 2 = 1 r 1
+1 / 2 = 0 r 1
+
+Writing out the remainders bottom to top gives you the bit pattern:
+
+1110100
+
+Checking your answer by converting the binary number back to decimal:
+
+(1*2^6)+(1*2^5)+(1*2^4)+(0*2^3)+(1*2^2)+(0*2^1)+(0*2^0) = 116
+
+So your answer is correct.
+```
\ No newline at end of file
diff --git a/guide/arabic/mathematics/converting-units-centimeters-to-meters/index.md b/guide/arabic/mathematics/converting-units-centimeters-to-meters/index.md
index 16b85b9ae3..4e8349669e 100644
--- a/guide/arabic/mathematics/converting-units-centimeters-to-meters/index.md
+++ b/guide/arabic/mathematics/converting-units-centimeters-to-meters/index.md
@@ -14,13 +14,15 @@ Centi- (رمز c) هي بادئة وحدة في النظام المتري تدل
في الصيغة التالية ، يتم تصنيف الوحدات مع أقواس \[\] حولها
- `[cm] / 100 = [m]
-`
+```
+[cm] / 100 = [m]
+```
إذا أدخلت القيمة التي لديك ، دعنا نقول 50 سم ، فسيتم حسابها على النحو التالي:
- `50[cm] / 100 = 0.5[m]
-`
+```
+50[cm] / 100 = 0.5[m]
+```
نتيجة حساب إرجاع قيمة 0.5 متر ، فإن كمية متر 50 سنتيمتر هو.
@@ -32,16 +34,17 @@ Centi- (رمز c) هي بادئة وحدة في النظام المتري تدل
### الترميز
- `function convertCentimeterToMeter (cm) {
- return ( cm / 100 );
- }
-
- // Set some example measurements
- var lengthInCm = 300;
- var lengthInM;
-
- lengthInM = convertCentimeterToMeter(lengthInCm); // 3
-`
+```js
+function convertCentimeterToMeter (cm) {
+ return ( cm / 100 );
+}
+
+// Set some example measurements
+var lengthInCm = 300;
+var lengthInM;
+
+lengthInM = convertCentimeterToMeter(lengthInCm); // 3
+```
### معلومات اكثر:
diff --git a/guide/arabic/mathematics/converting-units-minutes-to-hours/index.md b/guide/arabic/mathematics/converting-units-minutes-to-hours/index.md
index cada7a9401..109a0e93aa 100644
--- a/guide/arabic/mathematics/converting-units-minutes-to-hours/index.md
+++ b/guide/arabic/mathematics/converting-units-minutes-to-hours/index.md
@@ -19,10 +19,12 @@ localeTitle: تحويل وحدات دقيقة إلى ساعات
التحويل من الوقت بالدقائق إلى الوقت بالساعة:
- `90 minutes = (90 / 60) hours = 1.5 hours
-`
+```
+90 minutes = (90 / 60) hours = 1.5 hours
+```
التحويل من الوقت بالساعة إلى الوقت بالدقائق:
- `24 hours = (24 * 60) minutes = 1440 minutes
-`
\ No newline at end of file
+```
+24 hours = (24 * 60) minutes = 1440 minutes
+```
\ No newline at end of file
diff --git a/guide/arabic/mathematics/counting/combinations/index.md b/guide/arabic/mathematics/counting/combinations/index.md
index 2076c8ad3f..68dd906666 100644
--- a/guide/arabic/mathematics/counting/combinations/index.md
+++ b/guide/arabic/mathematics/counting/combinations/index.md
@@ -22,10 +22,11 @@ localeTitle: تركيبات
تعد التوليفات مفيدة جدًا عندما تريد حل المشكلات التجميعية مثل المشاكل التالية:
- `Compute the probability to obtain a poker from
- a standard fifty-two card deck drawing 5 cards
- at the same time
-`
+```
+Compute the probability to obtain a poker from
+a standard fifty-two card deck drawing 5 cards
+at the same time
+```
من أجل حل هذه المشكلة البسيطة ، تحتاج إلى حساب عدد 5 أيدي بطاقة ممكن باستخدام مجموعات:
diff --git a/guide/arabic/mathematics/index.md b/guide/arabic/mathematics/index.md
index 10605db30d..aa0fa60a55 100644
--- a/guide/arabic/mathematics/index.md
+++ b/guide/arabic/mathematics/index.md
@@ -30,37 +30,41 @@ private int CalculatePoweredArray (int int، int \[\] arr) { var poweredArray =
}
- `Calling the function with a power of 3 will give these results:
- [1, 8, 27, 64, 125]
-
- Documentation reference: MSDN.aspx)
-
- #### JavaScript
- With Node.js
-`
+```
+Calling the function with a power of 3 will give these results:
+[1, 8, 27, 64, 125]
+
+Documentation reference: MSDN.aspx)
+
+#### JavaScript
+With Node.js
+```
جافا سكريبت var math = requires ('mathjs')؛
- `In the browser
-`
+```
+In the browser
+```
أتش تي أم أل
// use the math.js libary math.sqrt(-4); // result: 2i
- `Documentation reference: Math.js documentation
-
- #### C++
-`
+```
+Documentation reference: Math.js documentation
+
+#### C++
+```
حزب الشعب الكمبودي
# تتضمن
- `Documentation reference: cplusplus reference
-
- #### Python
-`
+```
+Documentation reference: cplusplus reference
+
+#### Python
+```
الثعبان
@@ -73,10 +77,11 @@ private int CalculatePoweredArray (int int، int \[\] arr) { var poweredArray =
> > > استيراد numpy كما np np.zeros ((3،4))
- `This returns a 3x4 array populated with 0s.
-
- #### Java
-`
+```
+This returns a 3x4 array populated with 0s.
+
+#### Java
+```
جافا استيراد java.lang.Math
diff --git a/guide/arabic/mathematics/intro-to-logarithms/index.md b/guide/arabic/mathematics/intro-to-logarithms/index.md
index 7a8b7bb4a4..87988e180f 100644
--- a/guide/arabic/mathematics/intro-to-logarithms/index.md
+++ b/guide/arabic/mathematics/intro-to-logarithms/index.md
@@ -14,12 +14,13 @@ _هنا في المثال المتغير b هو القاعدة بينما الم
مثال على سجلات في بيثون:
- `import math
-
- # math.log(value, base) - outputs exponent
- math.log(100, 10) #outputs 2
- math.log(2, 2) #outputs 1
-`
+```python
+import math
+
+# math.log(value, base) - outputs exponent
+math.log(100, 10) #outputs 2
+math.log(2, 2) #outputs 1
+```
#### مصادر:
diff --git a/guide/arabic/mathematics/mean-median-mode-and-range/index.md b/guide/arabic/mathematics/mean-median-mode-and-range/index.md
index ad17dc0c4d..727f69eef5 100644
--- a/guide/arabic/mathematics/mean-median-mode-and-range/index.md
+++ b/guide/arabic/mathematics/mean-median-mode-and-range/index.md
@@ -6,54 +6,59 @@ localeTitle: يعني متوسط الوضع والمدى
يستخدم الإحصائيون وعلماء الرياضيات المتوسط والوسيط والوضع والنطاق لمعرفة معلومات حول مجموعة من الأرقام.
- `Example set:
-
- 5, -4, 11, 5, 5, 20, 8.5, 11
-`
+```
+Example set:
+
+5, -4, 11, 5, 5, 20, 8.5, 11
+```
لحساب **نطاق** مجموعة ، خذ الرقم الأكبر ، والرمز x ، وأقل عدد ، والرمز y ، وحساب xy. سيعطي النطاق إشارة إلى مدى انتشار الأرقام.
- `Smallest value: -4
- Largest value: 20
-
- 20 - (-4) = 24
-
- The range is 24
-`
+```
+Smallest value: -4
+Largest value: 20
+
+20 - (-4) = 24
+
+The range is 24
+```
لحساب **المتوسط** ، أضف جميع الأرقام معًا وانقسم على إجمالي عدد العناصر في المجموعة. هذا هو المقصود عادة عند مناقشة "المتوسط".
- `5 + (-4) + 11 + 5 + 5 + 20 + 8.5 + 11 = 61.5
-
- Sum: 61.5
- Count: 8
-
- 61.5 / 8 = 7.6875
-
- The mean is 7.6875
-`
+```
+5 + (-4) + 11 + 5 + 5 + 20 + 8.5 + 11 = 61.5
+
+Sum: 61.5
+Count: 8
+
+61.5 / 8 = 7.6875
+
+The mean is 7.6875
+```
لحساب **الوضع** ، ابحث عن الرقم الذي يتم تكراره بشكل متكرر. على سبيل المثال ، بالنسبة للأعداد 1،2،3،4،5،6،7،7،7 سيكون الوضع 7 لأن هناك ثلاثة 7s في المجموعة ، وهو أعلى من أي رقم آخر.
- `Put the set in order so it's easier to see how
- many of each value there are:
-
- -4, 5, 5, 5, 8.5, 11, 11, 20
-
- 5 appears three times, 11 appears twice and
- everything else appears once.
-
- The mode is 5
-`
+```
+Put the set in order so it's easier to see how
+many of each value there are:
+
+-4, 5, 5, 5, 8.5, 11, 11, 20
+
+5 appears three times, 11 appears twice and
+everything else appears once.
+
+The mode is 5
+```
لحساب **المتوسط** ، قم بترتيب كافة الأرقام بترتيب متزايد وقم بتخطي أعلى وأعلى رقم حتى يظهر رقم واحد أو رقمين فقط. إذا كان هناك رقم واحد متبقٍ ، فهذا الرقم هو الوسيط. إذا كان هناك رقمان ، فقم بإضافة رقمين ثم قسّم على 2 للحصول على الوسيط. على سبيل المثال ، في 1،2،3،4،5،6،7،7،7 سيكون المتوسط 5.
- `First, put the set in order:
-
- -4, 5, 5, 5, 8.5, 11, 11, 20
-
- The third 5 and 8.5 are the middle values...
- (5 + 8.5) / 2 = 6.75
-
- The median is 6.75
-`
\ No newline at end of file
+```
+First, put the set in order:
+
+-4, 5, 5, 5, 8.5, 11, 11, 20
+
+The third 5 and 8.5 are the middle values...
+(5 + 8.5) / 2 = 6.75
+
+The median is 6.75
+```
\ No newline at end of file
diff --git a/guide/arabic/miscellaneous/add-font-awesome-icons-to-our-buttons/index.md b/guide/arabic/miscellaneous/add-font-awesome-icons-to-our-buttons/index.md
index 5c983956d6..c7a4cde767 100644
--- a/guide/arabic/miscellaneous/add-font-awesome-icons-to-our-buttons/index.md
+++ b/guide/arabic/miscellaneous/add-font-awesome-icons-to-our-buttons/index.md
@@ -8,15 +8,15 @@ Font Awesome هي مكتبة ملائمة من الرموز. هذه الرموز
هيريس كيف تضيف أيقونة:
- `
-
-`
+```html
+
+```
إليك كيفية إدراج هذا الرمز على زر:
- `
-
-`
+```html
+
+```
#### معلومات اكثر:
diff --git a/guide/arabic/miscellaneous/capitalize-the-first-letter-of-a-string/index.md b/guide/arabic/miscellaneous/capitalize-the-first-letter-of-a-string/index.md
index 81c5191225..5302afb958 100644
--- a/guide/arabic/miscellaneous/capitalize-the-first-letter-of-a-string/index.md
+++ b/guide/arabic/miscellaneous/capitalize-the-first-letter-of-a-string/index.md
@@ -13,10 +13,11 @@ localeTitle: تكبير الحرف الأول من سلسلة
يجب عليك استخدام طريقة [charAt ()](http://forum.freecodecamp.com/t/javascript-string-prototype-charat/15932) ، في _الفهرس 0_ ، لتحديد الحرف الأول من السلسلة.
- `var string = "freeCodecamp";
-
- string.charAt(0); // Returns "f"
-`
+```javascript
+var string = "freeCodecamp";
+
+string.charAt(0); // Returns "f"
+```
> ملاحظة: يفضل استخدام `charAt` `[ ]` ( [تدوين قوس](http://forum.freecodecamp.com/t/javascript-string-prototype-touppercase/15950) ) باسم `str.charAt(0)` إرجاع سلسلة فارغة ( _`''`_ ) لـ `str = ''` بدلاً من `undefined` في حالة `''[0]` .
@@ -24,48 +25,52 @@ localeTitle: تكبير الحرف الأول من سلسلة
يمكنك استخدام أسلوب [toUpperCase ()](http://forum.freecodecamp.com/t/javascript-string-prototype-touppercase/15950) وتحويل سلسلة الاستدعاء إلى الحالة العليا.
- `var string = "freeCodecamp";
-
- string.charAt(0).toUpperCase(); // Returns "F"
-`
+```javascript
+var string = "freeCodecamp";
+
+string.charAt(0).toUpperCase(); // Returns "F"
+```
## 3\. الحصول على البقية من السلسلة
يمكنك استخدام طريقة [شريحة ()](https://github.com/freecodecamp/freecodecamp/wiki/js-array-prototype-slice) والحصول على الباقي من السلسلة (من الحرف الثاني ، _الفهرس 1_ ، إلى نهاية السلسلة).
- `var string = "freeCodecamp";
-
- string.slice(1); // Returns "reeCodecamp"
-`
+```javascript
+var string = "freeCodecamp";
+
+string.slice(1); // Returns "reeCodecamp"
+```
## 4\. قم بإرجاع النتيجة بإضافة الحرف الأول وبقية السلسلة
يجب إنشاء دالة تقبل سلسلة كوسيطة فقط وترجع سلسلة الأحرف الأولى `string.charAt(0).toUpperCase()` والباقي من السلسلة `string.slice(1)` .
- `var string = "freeCodecamp";
-
- function capitalizeFirstLetter(str) {
- return str.charAt(0).toUpperCase() + str.slice(1);
- }
-
- capitalizeFirstLetter(string); // Returns "FreeCodecamp"
-`
+```javascript
+var string = "freeCodecamp";
+
+function capitalizeFirstLetter(str) {
+ return str.charAt(0).toUpperCase() + str.slice(1);
+}
+
+capitalizeFirstLetter(string); // Returns "FreeCodecamp"
+```
أو يمكنك إضافة هذه الوظيفة إلى `String.prototype` لاستخدامها مباشرةً على سلسلة باستخدام التعليمة البرمجية التالية ( _بحيث لا يمكن حساب هذه الطريقة ولكن يمكن استبدالها أو حذفها لاحقًا_ ):
- `var string = "freeCodecamp";
-
- /* this is how methods are defined in prototype of any built-in Object */
- Object.defineProperty(String.prototype, 'capitalizeFirstLetter', {
- value: function () {
- return this.charAt(0).toUpperCase() + this.slice(1);
- },
- writable: true, // so that one can overwrite it later
- configurable: true // so that it can be deleted later
- });
-
- string.capitalizeFirstLetter(); // Returns "FreeCodecamp"
-`
+```javascript
+var string = "freeCodecamp";
+
+/* this is how methods are defined in prototype of any built-in Object */
+Object.defineProperty(String.prototype, 'capitalizeFirstLetter', {
+ value: function () {
+ return this.charAt(0).toUpperCase() + this.slice(1);
+ },
+ writable: true, // so that one can overwrite it later
+ configurable: true // so that it can be deleted later
+});
+
+string.capitalizeFirstLetter(); // Returns "FreeCodecamp"
+```
### مصدر
diff --git a/guide/arabic/miscellaneous/how-to-redirect-a-web-page/index.md b/guide/arabic/miscellaneous/how-to-redirect-a-web-page/index.md
index caf47640da..7ad69ea501 100644
--- a/guide/arabic/miscellaneous/how-to-redirect-a-web-page/index.md
+++ b/guide/arabic/miscellaneous/how-to-redirect-a-web-page/index.md
@@ -22,7 +22,8 @@ localeTitle: كيفية إعادة توجيه صفحة ويب
`
- `There is another option if you just want to change the page as soon as they reach that page:
-`
+```
+There is another option if you just want to change the page as soon as they reach that page:
+```
جافا سكريبت window.location.assign ( "HTTPS: //www.yournewwebsite.fakewebsite")؛ \`\` \` استبدال موقع الويب بموقعك على الويب. ينبغي للمرء أن يذهب داخل ملف جافا سكريبت.
\ No newline at end of file
diff --git a/guide/arabic/miscellaneous/html-and-css-cheat-sheet/index.md b/guide/arabic/miscellaneous/html-and-css-cheat-sheet/index.md
index ed69360aaa..cbd514ff33 100644
--- a/guide/arabic/miscellaneous/html-and-css-cheat-sheet/index.md
+++ b/guide/arabic/miscellaneous/html-and-css-cheat-sheet/index.md
@@ -30,9 +30,9 @@ localeTitle: HTML و CSS Cheat Sheet
جرب قيمًا مختلفة لمعرفة كيفية تأثيرها على div وأكثر في html
- `
-
-`
+```html
+
+```
## محاذاة عمودية (لسطر واحد من النص)
diff --git a/guide/arabic/miscellaneous/learn-about-jsonp/index.md b/guide/arabic/miscellaneous/learn-about-jsonp/index.md
index fca96136ac..c5a0e04b79 100644
--- a/guide/arabic/miscellaneous/learn-about-jsonp/index.md
+++ b/guide/arabic/miscellaneous/learn-about-jsonp/index.md
@@ -6,15 +6,17 @@ localeTitle: تعرف على Jsonp
JSONP لتقف على "JSON مع الحشو". لنفترض أنك تريد تقديم طلبات AJAX إلى نطاق مختلف. حسنا ، لا يمكنك القيام بذلك مع XMLHttpRequest ، كما تفعل عادة ، ولكن يمكنك القيام بذلك مع علامات البرنامج النصي ، كما رأينا [على StackOverflow](https://stackoverflow.com/questions/2067472/what-is-jsonp-all-about) :
- `script = document.createElement('script');
- script.type = 'text/javascript';
- script.src = 'http://www.someWebApiServer.com/some-data';
-`
+```javascript
+script = document.createElement('script');
+script.type = 'text/javascript';
+script.src = 'http://www.someWebApiServer.com/some-data';
+```
ولكن هذا قبيح ، والآن لدينا للحصول على عناصر من JSON من علامة النصي ، الإجمالي. لحسن الحظ ، كان منشئو JSONP يفكرون في المستقبل ، لذا بدلاً من وضع نصوصنا كما فعلنا أعلاه ، نقوم بذلك:
- `script.src = 'http://www.someWebApiServer.com/some-data?callback=my_callback';
-`
+```javascript
+script.src = 'http://www.someWebApiServer.com/some-data?callback=my_callback';
+```
يؤدي هذا إلى معاودة الاتصال التلقائي بعد تحميل البيانات ، مما يؤدي إلى إنشاء وظيفة بالبيانات المطلوبة داخلها.
diff --git a/guide/arabic/miscellaneous/testing-with-chaijs/index.md b/guide/arabic/miscellaneous/testing-with-chaijs/index.md
index 7d36c3d947..f25cac625e 100644
--- a/guide/arabic/miscellaneous/testing-with-chaijs/index.md
+++ b/guide/arabic/miscellaneous/testing-with-chaijs/index.md
@@ -8,17 +8,19 @@ localeTitle: اختبار مع Chaijs
يمكنك تثبيت Chai في مشروعك من خلال npm.
- `npm install chai
-`
+```
+npm install chai
+```
##### المؤيدة للطرف
إضافة Chai في devDependencies of _package.json_ ، باستخدام \* كعلامة إصدار. بهذه الطريقة ، لديك دائمًا أحدث إصدار.
- `"devDependencies": {
- "chai": "*"
- }
-`
+```
+"devDependencies": {
+ "chai": "*"
+}
+```
### كيف تستعمل
diff --git a/guide/arabic/mobile-app-development/cordova-ios-application-development-setup-to-deployment/index.md b/guide/arabic/mobile-app-development/cordova-ios-application-development-setup-to-deployment/index.md
index 4af05768bf..d333a6aa8c 100644
--- a/guide/arabic/mobile-app-development/cordova-ios-application-development-setup-to-deployment/index.md
+++ b/guide/arabic/mobile-app-development/cordova-ios-application-development-setup-to-deployment/index.md
@@ -14,10 +14,11 @@ localeTitle: إعداد تطوير تطبيق Cordova iOS للنشر
ابدأ بفتح الوحدة الطرفية وإنشاء مشروع Cordova جديد (استخدم sudo فقط إذا كان لديك مشكلات في الإذن ، أي أخطاء EACCESS):
- `sudo cordova create iosdemo
- cd iosdemo
- sudo cordova platform add ios
-`
+```
+sudo cordova create iosdemo
+cd iosdemo
+sudo cordova platform add ios
+```
في وقت كتابة هذا الدليل ، فإن هذا الإصدار من منصة Cordova iOS هو: 4.3.1
@@ -25,13 +26,15 @@ localeTitle: إعداد تطوير تطبيق Cordova iOS للنشر
الخطوة التالية هي لتشغيل الأمر بناء كوردوفا. سيؤدي هذا إلى تحويل شفرة التطبيق إلى ملف .xcodeproj الذي سنستخدمه بعد ذلك.
- `sudo cordova build ios
-`
+```
+sudo cordova build ios
+```
سيكون ملف مشروع Xcode الذي تم إنشاؤه في:
- `[Your App Folder]/platforms/ios/[Your App Name].xcodeproj
-`
+```
+[Your App Folder]/platforms/ios/[Your App Name].xcodeproj
+```
الآن في حالة حدوث Android ، يتم توقيع الشفرة باستخدام ملف Keystore بتنسيق jj. ومع ذلك ، في حالة ركاب iOS لتوزيع تطبيقات iOS ، يجب أن يكون لديك حساب مطوّر برامج Apple ، هذا حتى نتمكن من إنشاء _الشهادات_ _وملفات التعريف الاحتياطية_ اللازمة لتوزيع التطبيق.
diff --git a/guide/arabic/mobile-app-development/firebase-cloud-messaging-integration-for-cordova-hybrid-apps/index.md b/guide/arabic/mobile-app-development/firebase-cloud-messaging-integration-for-cordova-hybrid-apps/index.md
index f99e49d7f6..955f55cbf8 100644
--- a/guide/arabic/mobile-app-development/firebase-cloud-messaging-integration-for-cordova-hybrid-apps/index.md
+++ b/guide/arabic/mobile-app-development/firebase-cloud-messaging-integration-for-cordova-hybrid-apps/index.md
@@ -12,19 +12,21 @@ localeTitle: Firebase Cloud Messaging Integration for Cordova Hybrid Apps
قم بإنشاء مجلد فارغ pushSample
- `cd '/opt/lampp/htdocs'
- mkdir pushSample
- cd pushSample
- cordova create pushSample
- cd pushSample
- cordova platform add android
- cordova plugin add cordova-plugin-FCM
-`
+```
+cd '/opt/lampp/htdocs'
+mkdir pushSample
+cd pushSample
+cordova create pushSample
+cd pushSample
+cordova platform add android
+cordova plugin add cordova-plugin-FCM
+```
أثناء إضافة المكوّن الإضافي Cordova FCM ، سيظهر خطأ:
- `Error: cordova-plugin-fcm: You have installed platform android but file 'google-services.json' was not found in your Cordova project root folder.
-`
+```
+Error: cordova-plugin-fcm: You have installed platform android but file 'google-services.json' was not found in your Cordova project root folder.
+```
ملاحظة: يرجع ذلك إلى أننا لم نضف ملف google-services.json الذي يجب إنشاؤه في الخطوات التالية.
@@ -36,38 +38,40 @@ localeTitle: Firebase Cloud Messaging Integration for Cordova Hybrid Apps
في النموذج المنبثق التالي ، املأ التفاصيل كما يلي: **اسم حزمة Android: اسم** الحزمة أو معرفها هو المعرف الفريد لأحد التطبيقات في متجر Play. لاحظ أنها قيمة مهمة جدًا لا يمكن تغييرها لأحد التطبيقات بمجرد تحميلها إلى متجر Play. سيكون في بناء جملة اسم النطاق العكسي: على سبيل المثال ، سيكون لدى hello.pushSample.com معرف التطبيق: com.pushSample.hello. أيضا في ملف **config.xml** في مشروع كوردوفا الخاص بك تعيين معرف التطبيق نفسه. لمشروع العينة لدينا سيكون في: pushSample / pushSample / config.xml على سبيل المثال بالنسبة لي محتويات هذا الملف هي:
- `
-
- HelloCordova
-
- A sample Apache Cordova application that responds to the deviceready event.
-
-
- Apache Cordova Team
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-`
+```xml
+
+
+ HelloCordova
+
+ A sample Apache Cordova application that responds to the deviceready event.
+
+
+ Apache Cordova Team
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
لاحظ العلامة
- `
-`
+```xml
+
+```
هنا هوية السمة هو **معرف** حزمة والتي سوف يكون افتراضيا **io.cordova.hellocordova** تغييره إلى معرف التطبيق الذي قمت بتحديده في وحدة تحكم firebase. سوف أستخدم com.pushSample.hello
@@ -87,38 +91,41 @@ localeTitle: Firebase Cloud Messaging Integration for Cordova Hybrid Apps
بمجرد حصولك على الملف ، الصقه في المجلد الجذر لمشروع Cordova الخاص بك ، في حالتي:
- `/opt/lampp/htdocs/pushSample/pushSample
-`
+```
+/opt/lampp/htdocs/pushSample/pushSample
+```
المقبل بناء المشروع
- `cordova build android
-`
+```
+cordova build android
+```
بعد إضافة ملف google-services.json ، يجب أن يتم إنشاؤه بنجاح.
بعد ذلك ، يتعين علينا كتابة رمز جانب العميل للتعامل مع إشعارات الدفع:
- `FCMPlugin.getToken(function(token) {
- //this is the FCM token which can be used
- //to send notification to specific device
- console.log(token);
- //FCMPlugin.onNotification( onNotificationCallback(data), successCallback(msg), errorCallback(err) )
- //Here you define your application behaviour based on the notification data.
- FCMPlugin.onNotification(function(data) {
- console.log(data);
- //data.wasTapped == true means in Background : Notification was received on device tray and tapped by the user.
- //data.wasTapped == false means in foreground : Notification was received in foreground. Maybe the user needs to be notified.
- // if (data.wasTapped) {
- // //Notification was received on device tray and tapped by the user.
- // alert(JSON.stringify(data));
- // } else {
- // //Notification was received in foreground. Maybe the user needs to be notified.
- // alert(JSON.stringify(data));
- // }
- });
- });
-`
+```js
+FCMPlugin.getToken(function(token) {
+ //this is the FCM token which can be used
+ //to send notification to specific device
+ console.log(token);
+ //FCMPlugin.onNotification( onNotificationCallback(data), successCallback(msg), errorCallback(err) )
+ //Here you define your application behaviour based on the notification data.
+ FCMPlugin.onNotification(function(data) {
+ console.log(data);
+ //data.wasTapped == true means in Background : Notification was received on device tray and tapped by the user.
+ //data.wasTapped == false means in foreground : Notification was received in foreground. Maybe the user needs to be notified.
+ // if (data.wasTapped) {
+ // //Notification was received on device tray and tapped by the user.
+ // alert(JSON.stringify(data));
+ // } else {
+ // //Notification was received in foreground. Maybe the user needs to be notified.
+ // alert(JSON.stringify(data));
+ // }
+ });
+});
+```
يقوم الرمز أولاً باستدعاء الدالة **getToken** للحصول على رمز FCM المميز من firebase ، ثم في معاودة الاتصال يقوم بتسجيل رد **اتصال** آخر على **Notification** لمعالجة ما يحدث عند تلقي إعلام الدفع.
@@ -138,8 +145,9 @@ localeTitle: Firebase Cloud Messaging Integration for Cordova Hybrid Apps
سيظهر كائن البيانات في رد الاتصال onNotification على النحو التالي
- `{myKey2: "valuefor2", myKey: "valuefor1", wasTapped: false}
-`
+```js
+{myKey2: "valuefor2", myKey: "valuefor1", wasTapped: false}
+```
لاحظ أيضًا أنه عند إرسال إشعارات الدفع باستخدام واجهات برمجة تطبيقات REST من خادم تطبيقاتك بدلاً من ملحن إخطار Firebase ، يجب عليك استخدام البنية التالية:
@@ -209,58 +217,68 @@ localeTitle: Firebase Cloud Messaging Integration for Cordova Hybrid Apps
هنا ، كما ناقشنا سابقًا ، قم بتحميل مفتاح APNs Auth الذي أنشأته في مركز عضو Apple. بعد ذلك نقوم بإعداد تطبيق جانب العميل. إنشاء مجلد جديد sampleApp في مجلد التطوير الخاص بك ، بالنسبة لي هو
- `/Volumes/Development/
-`
+```
+/Volumes/Development/
+```
لذلك سيكون المجلد الجديد
- `/Volumes/Development/pushSample
- cd /Volumes/Development/pushSample
-`
+```
+/Volumes/Development/pushSample
+cd /Volumes/Development/pushSample
+```
إنشاء مشروع جديد Cordova ، **ملاحظة: استخدم sudo إذا لزم الأمر**
- `cordova create pushSample
- cd pushSample
-`
+```
+cordova create pushSample
+cd pushSample
+```
أضف الآن أحدث نظام iOS
- `sudo cordova platform add ios
-`
+```
+sudo cordova platform add ios
+```
الآن قم بلصق ملف **Googleservice-info.plist** الذي تم تنزيله مسبقًا في المجلد الجذر لمشروع Cordova ، وهو كذلك
- `/Volumes/Development/pushSample/pushSample
-`
+```
+/Volumes/Development/pushSample/pushSample
+```
إضافة البرنامج المساعد Cordova FCM.
- `cordova plugin add cordova-plugin-fcm
-`
+```
+cordova plugin add cordova-plugin-fcm
+```
حدِّث معرف التطبيق الافتراضي واسم التطبيق بمعرف الحزمة الذي قررناه سابقًا أثناء تهيئة وحدة التحكم في Firebase واسم التطبيق.
- `
- PushSample
-`
+```xml
+
+ PushSample
+```
في هذه المرحلة ، سيحتوي نموذج التعليمة البرمجية على ملف app.js ، والذي يمكنك تعديله وإضافة وظائف getToken و onNotification مثل android. شفرة javascript هي نفسها لكلا المنصتين.
التالي تشغيل الأمر بناء cordova
- `sudo cordova build ios
-`
+```
+sudo cordova build ios
+```
بمجرد نجاح أمر بناء cordova ، افتح التطبيق في xcode. للقيام بذلك ، افتح الملف xcode.proj الذي سيكون موجودًا في
- `your_cordova_project/platforms/ios/app_name.xcodeproj
-`
+```
+your_cordova_project/platforms/ios/app_name.xcodeproj
+```
بالنسبة لي هو
- `/Volumes/Development/pushSample/pushSample/platforms/ios/PushSample.xcodeproj
-`
+```
+/Volumes/Development/pushSample/pushSample/platforms/ios/PushSample.xcodeproj
+```

diff --git a/guide/arabic/nodejs/buffer/index.md b/guide/arabic/nodejs/buffer/index.md
index a12b37ddc6..93ef9f9cf1 100644
--- a/guide/arabic/nodejs/buffer/index.md
+++ b/guide/arabic/nodejs/buffer/index.md
@@ -14,13 +14,15 @@ localeTitle: Nodejs- Buffer
هناك طرق مختلفة يمكنك إنشاء مخزن مؤقت في Node.js. يمكنك إنشاء مخزن مؤقت فارغ بحجم 10 بايت.
- `const buf1 = Buffer.alloc(10);
-`
+```javascript
+const buf1 = Buffer.alloc(10);
+```
من السلاسل UTF-8-encoded ، يكون الإنشاء كالتالي:
- `const buf2 = Buffer.from('Hello World!');
-`
+```javascript
+const buf2 = Buffer.from('Hello World!');
+```
هناك ترميز مقبول مختلف عند إنشاء مخزن مؤقت:
@@ -33,8 +35,9 @@ localeTitle: Nodejs- Buffer
هناك ثلاث وظائف منفصلة مخصصة في API Buffer لاستخدام وإنشاء مخازن جديدة. في الأمثلة أعلاه رأينا `alloc()` ومن `from()` . والثالث هو `allocUnsafe()` .
- `const buf3 = Buffer.allocUnsafe(10);
-`
+```javascript
+const buf3 = Buffer.allocUnsafe(10);
+```
عند إعادتها ، قد تحتوي هذه الوظيفة على بيانات قديمة تحتاج إلى الكتابة فوقها.
@@ -42,40 +45,45 @@ localeTitle: Nodejs- Buffer
هناك تفاعلات مختلفة يمكن إجراؤها باستخدام واجهة برمجة تطبيقات Buffer. سنقوم بتغطية معظمهم هنا. دعونا نبدأ بتحويل مخزن مؤقت إلى JSON.
- `let bufferOne = Buffer.from('This is a buffer example.');
- console.log(bufferOne);
-
- // Output:
-
- let json = JSON.stringify(bufferOne);
- console.log(json);
-
- // Output: {"type": "Buffer", "data": [84,104,105,115,32,105,115,32,97,32,98,117,102,102,101,114,32,101,120,97,109,112,108,101,46]}
-`
+```javascript
+let bufferOne = Buffer.from('This is a buffer example.');
+console.log(bufferOne);
+
+// Output:
+
+let json = JSON.stringify(bufferOne);
+console.log(json);
+
+// Output: {"type": "Buffer", "data": [84,104,105,115,32,105,115,32,97,32,98,117,102,102,101,114,32,101,120,97,109,112,108,101,46]}
+```
تحدد JSON أن نوع الكائن الذي تم تحويله هو Buffer ، وبياناته. سيظهر لنا تحويل مخزن مؤقت فارغ إلى JSON أنه لا يحتوي على أي شيء سوى الأصفار.
- `const emptyBuf = Buffer.alloc(10);
-
- emptyBuf.toJSON();
-
- // Output: { "type": "Buffer", "data": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }
-`
+```javascript
+const emptyBuf = Buffer.alloc(10);
+
+emptyBuf.toJSON();
+
+// Output: { "type": "Buffer", "data": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }
+```
لاحظ أن Buffer API يوفر أيضًا دالة مباشرة `toJSON()` لتحويل مخزن مؤقت إلى كائن JSON. لفحص حجم المخزن المؤقت ، يمكننا استخدام طريقة `length` .
- `emptyBuf.length;
- // Output: 10
-`
+```javascript
+emptyBuf.length;
+// Output: 10
+```
الآن دعونا تحويل المخزن المؤقت إلى سلسلة قابلة للقراءة ، في حالتنا ، ترميز utf-8.
- `console.log(bufferOne.toString('utf8'));
-
- // Output: This is a buffer example.
-`
+```javascript
+console.log(bufferOne.toString('utf8'));
+
+// Output: This is a buffer example.
+```
`.toString()` بشكل افتراضي بتحويل مخزن مؤقت إلى سلسلة تنسيق utf-8. هذه هي الطريقة التي فك ترميز المخزن المؤقت. إذا قمت بتحديد ترميز ، يمكنك تحويل المخزن المؤقت إلى ترميز آخر
- `console.log(bufferOne.toString('base64'));
-`
\ No newline at end of file
+```javascript
+console.log(bufferOne.toString('base64'));
+```
\ No newline at end of file
diff --git a/guide/arabic/nodejs/event-emitters/index.md b/guide/arabic/nodejs/event-emitters/index.md
index b65d4e9680..2283674e1c 100644
--- a/guide/arabic/nodejs/event-emitters/index.md
+++ b/guide/arabic/nodejs/event-emitters/index.md
@@ -12,29 +12,33 @@ EventEmitters هي واحدة من الأفكار الأساسية وراء بن
للوصول إلى فئة EventEmitter في برنامج Node.js ، يجب عليك طلب وحدة `events` من واجهة برمجة التطبيقات Node.js. لإنشاء الكائن ، نقوم بإنشاء مثيل لفئة EventEmitter من خلال استدعاء دالة منشئه.
- `const events = require('events');
-
- const eventEmitter = new events.EventEmitter();
-`
+```js
+const events = require('events');
+
+const eventEmitter = new events.EventEmitter();
+```
أو يمكنك مباشرة الوصول إلى فئة فرعية EventEmitter مثل:
- `const EventEmitter = require('events');
-
- const eventEmitter = new EventEmitter();
-`
+```js
+const EventEmitter = require('events');
+
+const eventEmitter = new EventEmitter();
+```
توفر فئة EventEmitter العديد من الأساليب المحددة مسبقًا للعمل مع الأحداث. هذه الأساليب هي `.on` و `.emit` و `.error` . يمكن إجراء بث لحدث من دالة مما يؤدي إلى وظيفة رد اتصال يمكن الوصول إليها من خلال أي وظيفة أخرى في JavaScript. هذا مثل البث.
يمكن تنفيذ القدرة على تشغيل حدث باتباع البنية:
- `eventEmitter.emit(eventName, optionalData);
-`
+```js
+eventEmitter.emit(eventName, optionalData);
+```
ويتم ذلك القدرة على إرفاق ظيفة المستمع وتحديد اسم الحدث المحدد الذي `.on` .
- `eventEmitter.emit(eventName, callback);
-`
+```js
+eventEmitter.emit(eventName, callback);
+```
سنقوم بمحاكاة الوظائف الجديدة التي تعلمناها للتو مع مثال. قم بإنشاء ملف جديد يسمى `eventemitter.js` وقم بلصق التعليمة البرمجية التالية:
@@ -54,9 +58,10 @@ EventEmitters هي واحدة من الأفكار الأساسية وراء بن
الآن قم بتشغيل المثال أعلاه باستخدام الأمر `node` ويجب أن تحصل على الإخراج التالي.
- `callback runs
- callback runs
-`
+```shell
+callback runs
+callback runs
+```
نبدأ من خلال خلق مثيل eventEmitter نستطيع من خلالها الحصول على `.on` هذه الطريقة. تضيف طريقة `.on` الحدث عن طريق تحديد `invoke` الاسم الذي نستخدمه لاحقًا في `.emit` للاتصال باستدعاء وظيفة رد الاتصال المرتبطة به.
@@ -78,8 +83,9 @@ EventEmitters هي واحدة من الأفكار الأساسية وراء بن
انتاج |
- `callback runs
-`
+```shell
+callback runs
+```
`.once` الاحتفاظ بمسارات الأحداث عندما يتم تشغيلها وعدد المرات التي يتم تشغيلها بخلاف طريقة `.on` التي لا تتبع مثل هذا المسار. هذا هو الفرق الرئيسي بين الاثنين.
@@ -110,8 +116,9 @@ EventEmitters هي واحدة من الأفكار الأساسية وراء بن
يسمح لك الدفق المقروء بقراءة البيانات من المصدر. يمكن أن يكون هذا المصدر أي شيء من مخزن مؤقت أو ملف أو ما إلى ذلك. أولاً ، قم بإنشاء ملف نصي بسيط للملف الذي سنقوم من خلاله بقراءة البيانات باستخدام الدفق.
- `I am Text file that contains data.
-`
+```text
+I am Text file that contains data.
+```
الآن ، قم بإنشاء ملف جديد يسمى read.js والذي سينفذ وظيفة قراءة البيانات من هذا الملف النصي باستخدام دفق مقروء.
@@ -160,11 +167,12 @@ EventEmitters هي واحدة من الأفكار الأساسية وراء بن
إذا أردنا كتابة المثال أعلاه باستخدام الأنبوب ، فسوف نكتب كما يلي:
- `const fs = require('fs');
- const readableStream = fs.createReadStream('./abc.txt');
- const writeableStream = fs.createWriteStream('./dest.txt');
-
- readableStream.pipe(writeableStream);
-`
+```js
+const fs = require('fs');
+const readableStream = fs.createReadStream('./abc.txt');
+const writeableStream = fs.createWriteStream('./dest.txt');
+
+readableStream.pipe(writeableStream);
+```
لاحظ عدد أسطر الرمز التي أزلناها. أيضا ، نحن الآن بحاجة فقط إلى مسارات الملفات المصدر والوجهة ولقراءة وكتابة البيانات التي نستخدمها `.pipe()` .
\ No newline at end of file
diff --git a/guide/arabic/nodejs/express/index.md b/guide/arabic/nodejs/express/index.md
index 2e05138b18..697d101b0b 100644
--- a/guide/arabic/nodejs/express/index.md
+++ b/guide/arabic/nodejs/express/index.md
@@ -14,11 +14,12 @@ Express هو إطار Node.js الأكثر شيوعًا لأنه يتطلب ال
للتحقق مما إذا كان كل شيء مثبتًا بشكل صحيح ، يرجى فتح الجهاز ونوع:
- `node --version
- v5.0.0
- npm --version
- 3.5.2
-`
+```shell
+node --version
+v5.0.0
+npm --version
+3.5.2
+```
إذا كنت تحصل على رقم الإصدار بدلاً من خطأ ، فهذا يعني أنك قمت بتثبيت Node.js و npm بنجاح.
@@ -38,50 +39,54 @@ Express هو إطار Node.js الأكثر شيوعًا لأنه يتطلب ال
يحتوي ملف JSON (تدوين كائن جافا سكريبت) على كل معلومات عن أي مشروع Express. عدد الوحدات النمطية المثبتة ، واسم المشروع ، والإصدار ، وغيرها من معلومات التعريف. لإضافة Expressjs كوحدة نمطية في مشروعنا ، نحتاج أولاً إلى إنشاء دليل مشروع ثم إنشاء ملف package.json.
- `mkdir express-app-example
- cd express-app-example
- npm init --yes
-`
+```shell
+mkdir express-app-example
+cd express-app-example
+npm init --yes
+```
سيؤدي هذا إلى إنشاء ملف `package.json` في جذر دليل المشروع. لتثبيت أي وحدة نمطية من `npm` نحتاج إلى وجود ملف `package.json` في هذا الدليل.
- `{
- "name": "express-web-app",
- "version": "0.1.0",
- "description": "",
- "main": "index.js",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "keywords": [],
- "license": "MIT"
- }
-`
+```json
+{
+ "name": "express-web-app",
+ "version": "0.1.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [],
+ "license": "MIT"
+}
+```
### تثبيت اكسبرس
الآن لدينا ملف `package.json` ، يمكننا تثبيت Express عن طريق تشغيل الأمر:
- `npm install --save express
-`
+```shell
+npm install --save express
+```
يمكننا التأكد من أن Express قد تم تثبيته بشكل صحيح بطريقتين. أولاً ، سيكون هناك قسم جديد في ملف `package.json` يسمى `dependencies` التي يوجد تحتها Express الخاص بنا:
- `{
- "name": "express-web-app",
- "version": "0.1.0",
- "description": "",
- "main": "index.js",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "keywords": [],
- "license": "MIT",
- "dependencies": {
- "express": "4.16.0"
- }
- }
-`
+```json
+{
+ "name": "express-web-app",
+ "version": "0.1.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [],
+ "license": "MIT",
+ "dependencies": {
+ "express": "4.16.0"
+ }
+}
+```
الطريقة الثانية هي أن مجلدًا جديدًا يسمى `node_modules` ظهر فجأة في جذر دليل مشروعنا. يخزن هذا المجلد الحزم التي نثبتها محليًا في مشروعنا.
@@ -89,18 +94,20 @@ Express هو إطار Node.js الأكثر شيوعًا لأنه يتطلب ال
لاستخدام حزمة التثبيت الخاصة بنا لإطار Express وإنشاء تطبيق خادم بسيط ، سنقوم بإنشاء الملف ، `index.js` ، في جذر دليل مشروعنا.
- `const express = require('express');
- const app = express();
-
- app.get('/', (req, res) => res.send('Hello World!'));
-
- app.listen(3000, () => console.log('Example app listening on port 3000!'));
-`
+```javascript
+const express = require('express');
+const app = express();
+
+app.get('/', (req, res) => res.send('Hello World!'));
+
+app.listen(3000, () => console.log('Example app listening on port 3000!'));
+```
لبدء تشغيل الخادم ، انتقل إلى جهازك واكتب:
- `node index.js
-`
+```shell
+node index.js
+```
هذا سيبدأ الخادم. سوف يستمع هذا التطبيق الحد الأدنى على المنفذ 3000. نحن نقدم طلبا من خلال متصفحنا على `http://localhost:3000` وسوف يستجيب الخادم الخاص بنا مع `Hello World` حيث يكون المتصفح هو العميل وستظهر الرسالة هناك.
@@ -148,8 +155,9 @@ Express هو إطار Node.js الأكثر شيوعًا لأنه يتطلب ال
يمكن أن تكون المسارات إما صفحات ويب قديمة جيدة أو نقاط نهاية REST API. في كلتا الحالتين ، يمكن تعريف بناء الجملة على أنه بناء مماثل لطريق ما على النحو التالي:
- `app.METHOD(PATH, HANDLER);
-`
+```javascript
+app.METHOD(PATH, HANDLER);
+```
تساعد أجهزة التوجيه في فصل المخاوف مثل نقاط النهاية المختلفة والحفاظ على الأجزاء ذات الصلة من شفرة المصدر معًا. يساعدون في بناء كود قابل للصيانة. يتم تعريف جميع الطرق قبل استدعاء الدالة `app.listen()` . في تطبيق Express النموذجي ، `app.listen()` آخر وظيفة يتم تنفيذها.
@@ -157,9 +165,10 @@ Express هو إطار Node.js الأكثر شيوعًا لأنه يتطلب ال
HTTP هو بروتوكول قياسي لعميل وخادم للاتصال. يوفر أساليب مختلفة للعميل لتقديم الطلب. يحتوي كل مسار على وظيفة hanlder على الأقل أو رد اتصال. تحدد وظيفة رد الاتصال هذه ما ستكون الاستجابة من الخادم لهذا المسار بعينه. على سبيل المثال ، يتم استخدام مسار `app.get()` لمعالجة طلبات GET وفي المقابل إرسال رسالة بسيطة كرد.
- `// GET method route
- app.get('/', (req, res) => res.send('Hello World!'));
-`
+```javascript
+// GET method route
+app.get('/', (req, res) => res.send('Hello World!'));
+```
### مسارات التوجيه
@@ -167,13 +176,14 @@ HTTP هو بروتوكول قياسي لعميل وخادم للاتصال. يو
دعنا نحدد نقطتي نهايتين أخريين في تطبيقنا القائم على الخادم.
- `app.get('/home', (req, res) => {
- res.send('Home Page');
- });
- app.get('/about', (req, res) => {
- res.send('About');
- });
-`
+```javascript
+app.get('/home', (req, res) => {
+ res.send('Home Page');
+});
+app.get('/about', (req, res) => {
+ res.send('About');
+});
+```
ضع في اعتبارك الشفرة الموضحة أعلاه كحد أدنى لموقع الويب الذي يحتوي على نقطتي نهايتين ، و `/about` أو `/home` و `/about` . إذا قدم العميل طلبًا للصفحة الرئيسية ، فسيتم الرد فقط مع `Home Page` وسيقوم `/about` بإرسال الاستجابة: `About Page` . نحن نستخدم وظيفة `res.send` لإرسال السلسلة مرة أخرى إلى العميل في حالة تحديد أي من الطريقتين المحددتين.
@@ -181,18 +191,20 @@ HTTP هو بروتوكول قياسي لعميل وخادم للاتصال. يو
تسمى معلمات المسار شرائح عناوين URL التي يتم استخدامها لالتقاط القيم المحددة في موضعها في عنوان URL. يتم استخدام كائن `req.params` في هذه الحالة لأنه لديه حق الوصول إلى جميع المعلمات التي تم تمريرها في عنوان url.
- `app.get('/books/:bookId', (req, res) => {
- res.send(req.params);
- });
-`
+```javascript
+app.get('/books/:bookId', (req, res) => {
+ res.send(req.params);
+});
+```
سيكون عنوان URL من العميل الوارد في شفرة المصدر أعلاه `http://localhost:3000/books/23` . يجب أن يتكون اسم معلمات المسار من أحرف (\[A-Za-z0-9\_\]). حالة استخدام عامة جدًا لمعلمة توجيه في طلبنا هي الحصول على مسار 404.
- `// For invalid routes
- app.get('*', (req, res) => {
- res.send('404! This is an invalid URL.');
- });
-`
+```javascript
+// For invalid routes
+app.get('*', (req, res) => {
+ res.send('404! This is an invalid URL.');
+});
+```
إذا بدأنا الآن الخادم من سطر الأوامر باستخدام `node index.js` وحاول زيارة عنوان URL: `http://localhost:3000/abcd` . ردا على ذلك ، سوف نحصل على رسالة 404.
@@ -232,38 +244,41 @@ HTTP هو بروتوكول قياسي لعميل وخادم للاتصال. يو
لإعداد أي برامج وسيطة ، سواء كانت مخصصة أو متوفرة كوحدة نمطية في npm ، نستخدم وظيفة `app.use()` . إنها كقاعدة معلمة اختيارية واحدة واستدعاء واحد للمعلمة الإلزامية. في حالتنا ، نحن لا نستخدم مسار paramaeter اختياري.
- `app.use((req, res, next) => {
- console.log('A new request received at ' + Date.now());
- next();
- });
-`
+```javascript
+app.use((req, res, next) => {
+ console.log('A new request received at ' + Date.now());
+ next();
+});
+```
يتم استدعاء الدالة الوسيطة أعلاه لكل طلب يقدمه العميل. عند تشغيل الخادم ، ستلاحظ أنه بالنسبة لكل طلب متصفح في نقطة النهاية `/` ، ستتم مطالبتك برسالة في جهازك:
- `A new request received at 1467267512545
-`
+```shell
+A new request received at 1467267512545
+```
يمكن استخدام وظائف الوسيطيات لمسار معين. انظر المثال أدناه:
- `const express = require('express');
- const app = express();
-
- //Simple request time logger for a specific route
- app.use('/home', (req, res, next) => {
- console.log('A new request received at ' + Date.now());
- next();
- });
-
- app.get('/home', (req, res) => {
- res.send('Home Page');
- });
-
- app.get('/about', (req, res) => {
- res.send('About Page');
- });
-
- app.listen(3000, () => console.log('Example app listening on port 3000!'));
-`
+```javascript
+const express = require('express');
+const app = express();
+
+//Simple request time logger for a specific route
+app.use('/home', (req, res, next) => {
+ console.log('A new request received at ' + Date.now());
+ next();
+});
+
+app.get('/home', (req, res) => {
+ res.send('Home Page');
+});
+
+app.get('/about', (req, res) => {
+ res.send('About Page');
+});
+
+app.listen(3000, () => console.log('Example app listening on port 3000!'));
+```
في هذه المرة ، سترى مطالبة مشابهة فقط عندما يطلب العميل نقطة النهاية `/home` منذ الإشارة إلى المسار في `app.use()` . لن يتم عرض أي شيء في المحطة عندما يطلب العميل نقطة النهاية `/about` .
@@ -281,19 +296,21 @@ HTTP هو بروتوكول قياسي لعميل وخادم للاتصال. يو
يسمح للمطورين بمعالجة البيانات الواردة ، مثل حمولة الجسم. الحمولة هي البيانات التي نتلقاها من العميل حتى تتم معالجتها. الأكثر فائدة مع طرق POST. يتم تثبيته باستخدام:
- `npm install --save body-parser
-`
+```shell
+npm install --save body-parser
+```
الاستعمال:
- `const bodyParser = require('body-parser');
-
- // To parse URL encoded data
- app.use(bodyParser.urlencoded({ extended: false }));
-
- // To parse json data
- app.use(bodyParser.json());
-`
+```javascript
+const bodyParser = require('body-parser');
+
+// To parse URL encoded data
+app.use(bodyParser.urlencoded({ extended: false }));
+
+// To parse json data
+app.use(bodyParser.json());
+```
من المحتمل أنها واحدة من أكثر استخدامات الوسيطة من طرف ثالث في أي تطبيق اكسبرس.
@@ -301,41 +318,47 @@ HTTP هو بروتوكول قياسي لعميل وخادم للاتصال. يو
يوزع رأس ملف تعريف الارتباط `req.cookies` مع كائن مرتبط بأسماء ملفات تعريف الارتباط. لتثبيته ،
- `$ npm install --save cookie-parser
-`
+```shell
+$ npm install --save cookie-parser
+```
- `const cookieParser = require('cookie-parser');
- app.use(cookieParser());
-`
+```javascript
+const cookieParser = require('cookie-parser');
+app.use(cookieParser());
+```
#### جلسة
تقوم وظيفة الوسيطة هذه بإنشاء وسيط جلسة مع خيارات محددة. غالبًا ما يتم استخدام جلسة في تطبيقات مثل تسجيل الدخول / التسجيل.
- `$ npm install --save session
-`
+```shell
+$ npm install --save session
+```
- `app.use(
- session({
- secret: 'arbitary-string',
- resave: false,
- saveUninitialized: true,
- cookie: { secure: true }
- })
- );
-`
+```javascript
+app.use(
+ session({
+ secret: 'arbitary-string',
+ resave: false,
+ saveUninitialized: true,
+ cookie: { secure: true }
+ })
+);
+```
### مورغان
يقوم البرنامج الوسيط مورغان بتتبع جميع الطلبات وغيرها من المعلومات المهمة اعتمادًا على تنسيق الإخراج المحدد.
- `npm install --save morgan
-`
+```shell
+npm install --save morgan
+```
- `const logger = require('morgan');
- // ... Configurations
- app.use(logger('common'));
-`
+```javascript
+const logger = require('morgan');
+// ... Configurations
+app.use(logger('common'));
+```
`common` هو حالة تنسيق مسبق يمكن استخدامها في التطبيق. هناك تنسيقات أخرى محددة مسبقًا مثل صغيرة ومبتكر ، ولكن يمكنك تحديد أنك تملك تنسيقًا مخصصًا أيضًا باستخدام معلمات السلسلة المتوفرة لنا من قِبل morgan.
@@ -349,39 +372,44 @@ HTTP هو بروتوكول قياسي لعميل وخادم للاتصال. يو
بشكل افتراضي ، لا يسمح Express بخدمة الملفات الثابتة. علينا استخدام هذه الوظيفة الوسيطة. من الممارسات الشائعة في تطوير تطبيق الويب هو تخزين جميع الملفات الثابتة تحت الدليل "العام" في جذر المشروع. يمكننا تقديم هذا المجلد لخدمة ملفات ثابتة تتضمن الكتابة في ملف `index.js` :
- `app.use(express.static('public'));
-`
+```javascript
+app.use(express.static('public'));
+```
الآن ، سيتم تحميل الملفات الثابتة في دليلنا العام.
- `http://localhost:3000/css/style.css
- http://localhost:3000/images/logo.png
- http://localhost:3000/images/bg.png
- http://localhost:3000/index.html
-`
+```shell
+http://localhost:3000/css/style.css
+http://localhost:3000/images/logo.png
+http://localhost:3000/images/bg.png
+http://localhost:3000/index.html
+```
### أدلة ثابتة متعددة
لاستخدام العديد من دلائل الأصول الثابتة ، اتصل بوظيفة الوسيطة `express.static` عدة مرات:
- `app.use(express.static('public'));
- app.use(express.static('files'));
-`
+```javascript
+app.use(express.static('public'));
+app.use(express.static('files'));
+```
### المسار الافتراضي البادئة
يمكن أيضًا توفير بادئة مسار الإصلاح كوسيطة أولى للدالة الوسيطة `express.static` . يُعرف هذا _بادئة مسار افتراضي_ لأن المسار الفعلي غير موجود في المشروع.
- `app.use('/static', express.static('public'));
-`
+```javascript
+app.use('/static', express.static('public'));
+```
إذا حاولنا الآن تحميل الملفات:
- `http://localhost:3000/static/css/style.css
- http://localhost:3000/static/images/logo.png
- http://localhost:3000/static/images/bg.png
- http://localhost:3000/static/index.html
-`
+```shell
+http://localhost:3000/static/css/style.css
+http://localhost:3000/static/images/logo.png
+http://localhost:3000/static/images/bg.png
+http://localhost:3000/static/index.html
+```
هذه التقنية تأتي في متناول اليدين عند توفير أدلة متعددة لخدمة ملفات ثابتة. يتم استخدام البادئات للمساعدة في التمييز بين الدلائل المتعددة.
@@ -391,14 +419,16 @@ HTTP هو بروتوكول قياسي لعميل وخادم للاتصال. يو
لشرح كيفية استخدام "محرك القوالب" ، سنستخدم Pug. إنه محرك قالب قوي يوفر ميزات مثل الفلاتر ، ويشمل ، الاستيفاء ، وما إلى ذلك. لاستخدامها ، يجب علينا أولاً تثبيت كوحدة نمطية في مشروعنا باستخدام `npm` .
- `npm install --save pug
-`
+```shell
+npm install --save pug
+```
سيقوم هذا الأمر بتثبيت الصلصة وللتحقق من تثبيتها بشكل صحيح ، فقط ألقي نظرة على ملف `package.json` . لاستخدامه مع تطبيقنا أولاً ، يجب علينا تعيينه كمحرك قالب وإنشاء دليل جديد ".views" حيث سنقوم بتخزين كافة الملفات المتعلقة بمحرك القالب الخاص بنا.
- `app.set('view engine', 'pug');
- app.set('views', './views');
-`
+```javascript
+app.set('view engine', 'pug');
+app.set('views', './views');
+```
بما أننا نستخدم `app.set()` الذي يشير إلى التكوين داخل ملف الخادم الخاص بنا ، يجب أن `app.set()` قبل تحديد أي مسار أو وظيفة وسيطة.
@@ -414,46 +444,49 @@ HTTP هو بروتوكول قياسي لعميل وخادم للاتصال. يو
لتشغيل هذه الصفحة ، سنقوم بإضافة الطريق التالي إلى طلبنا.
- `app.get('/hello', (req, res) => {
- res.render('index');
- });
-`
+```javascript
+app.get('/hello', (req, res) => {
+ res.render('index');
+});
+```
نظرًا لأننا قمنا بالفعل بتعيين `res.render` كمحرك القالب الخاص بنا ، فإننا في `res.render` لا نحتاج إلى توفير ملحق `.pug` . تعرض هذه الوظيفة الكود في أي ملف `.pug` إلى HTML `.pug` العميل. يمكن للمتصفحات تقديم ملفات HTML فقط. إذا قمت بتشغيل الخادم الآن ، وقمت بزيارة المسار `http://localhost:3000/hello` فسوف تشاهد إخراج `Hello World` بشكل صحيح.
في Pug ، يجب أن تلاحظ أننا لا نحتاج إلى كتابة علامات الإغلاق إلى العناصر كما نفعل في HTML. سيتم تقديم الكود السابق في HTML على النحو التالي:
- `
-
-
-
- Hello from Pug
-
-
-
-
Hello World!
-
-
-`
+```html
+
+
+
+ Hello from Pug
+
+
+
+
Hello World!
+
+
+```
ميزة استخدام "محرك القوالب" على ملفات HTML الخام هو أنها توفر الدعم لتنفيذ المهام عبر البيانات. لا يمكن لـ HTML تقديم البيانات مباشرة. تشترك الأطر مثل Angular و React في هذا السلوك مع محركات القوالب.
يمكنك أيضًا تمرير القيم إلى محرك القالب مباشرةً من وظيفة معالج التوجيه.
- `app.get('/', (req, res) => {
- res.render('index', { title: 'Hello from Pug', message: 'Hello World!' });
- });
-`
+```javascript
+app.get('/', (req, res) => {
+ res.render('index', { title: 'Hello from Pug', message: 'Hello World!' });
+});
+```
للحالة أعلاه ، سيتم كتابة ملف `index.pug` بنا على النحو التالي:
- `doctype html
- html
- head
- title= title
- body
- h1= message
-`
+```pug
+doctype html
+ html
+ head
+ title= title
+ body
+ h1= message
+```
سيكون الإخراج نفس الحالة السابقة.
@@ -463,30 +496,31 @@ HTTP هو بروتوكول قياسي لعميل وخادم للاتصال. يو
دعونا نذهب من خلال strucutre نموذجي لتطبيق ويب عبر الإنترنت.
- `project-root/
- node_modules/ // This is where the packages installed are stored
- config/
- db.js // Database connection and configuration
- credentials.js // Passwords/API keys for external services used by your app
- config.js // Environment variables
- models/ // For mongoose schemas
- books.js
- things.js
- routes/ // All routes for different entities in different files
- books.js
- things.js
- views/
- index.pug
- 404.pug
- ...
- public/ // All static files
- images/
- css/
- javascript/
- app.js
- routes.js // Require all routes in this and then require this file in
- app.js
- package.json
-`
+```
+project-root/
+ node_modules/ // This is where the packages installed are stored
+ config/
+ db.js // Database connection and configuration
+ credentials.js // Passwords/API keys for external services used by your app
+ config.js // Environment variables
+ models/ // For mongoose schemas
+ books.js
+ things.js
+ routes/ // All routes for different entities in different files
+ books.js
+ things.js
+ views/
+ index.pug
+ 404.pug
+ ...
+ public/ // All static files
+ images/
+ css/
+ javascript/
+ app.js
+ routes.js // Require all routes in this and then require this file in
+ app.js
+ package.json
+```
هذا هو النمط المعروف باسم MVC ، عارض عرض نموذج. ببساطة لأن نموذج قاعدة البيانات ، واجهة المستخدم الخاصة بالتطبيق ووحدات التحكم (في حالتنا ، الطرق) مكتوبة ومحفوظة في ملفات منفصلة. نمط التصميم هذا الذي يجعل أي تطبيق ويب سهل القياس إذا كنت ترغب في تقديم المزيد من المسارات أو الملفات الثابتة في المستقبل والرمز قابل للصيانة.
\ No newline at end of file
diff --git a/guide/arabic/nodejs/file-system/index.md b/guide/arabic/nodejs/file-system/index.md
index 72e78e13e1..6edb699234 100644
--- a/guide/arabic/nodejs/file-system/index.md
+++ b/guide/arabic/nodejs/file-system/index.md
@@ -10,8 +10,9 @@ localeTitle: نظام الملفات
من أجل تضمين وحدة نمطية ، استخدم الدالة `require()` مع اسم الوحدة.
- `const fs = require('fs');
-`
+```javascript
+const fs = require('fs');
+```
الاستخدام الشائع لوحدة نظام الملفات:
@@ -27,16 +28,17 @@ localeTitle: نظام الملفات
رمز Node.js لقراءة الملف من جهاز الكمبيوتر وإرجاع المحتوى إلى وحدة التحكم.
- `const fs = require('fs');
- fs.readFile('input.txt', 'utf-8', (err, data) => {
+```javascript
+const fs = require('fs');
+fs.readFile('input.txt', 'utf-8', (err, data) => {
if(err){
console.log(err);
}
else{
console.log("Content present in input.txt file : " + data.toString());
}
- });
-`
+});
+```
يقرأ الكود أعلاه ملف _input.txt_ من جهاز الكمبيوتر ويعيد المحتوى إلى وحدة التحكم.
diff --git a/guide/arabic/nodejs/http/index.md b/guide/arabic/nodejs/http/index.md
index 8e4c7728fe..101dcba0ad 100644
--- a/guide/arabic/nodejs/http/index.md
+++ b/guide/arabic/nodejs/http/index.md
@@ -10,24 +10,26 @@ localeTitle: HTTP
من أجل تضمين وحدة نمطية ، استخدم الدالة `require()` مع اسم الوحدة.
- `const http = require('http');
-`
+```javascript
+const http = require('http');
+```
## Node.js كملقم ويب
يتم استخدام الأسلوب `createServer()` لإنشاء خادم HTTP. الوسيطة الأولى من أسلوب `res.writeHead()` هي رمز الحالة ، `200` يعني أن كل شيء على ما يرام ، والوسيطة الثانية هي كائن يحتوي على رؤوس الاستجابة.
- `const http = require('http');
+```javascript
+const http = require('http');
- //create a server object:
- http.createServer((req, res) => {
+//create a server object:
+http.createServer((req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('Hello World!'); //write a response to the client
res.end(); //end the response
- }).listen(8000); //the server object listens on port 8000
+}).listen(8000); //the server object listens on port 8000
- console.log("Server is listening on port no : 8000");
-`
+console.log("Server is listening on port no : 8000");
+```
### خطوات التنفيذ:
diff --git a/guide/arabic/nodejs/index.md b/guide/arabic/nodejs/index.md
index 56401a7a11..4a22fb84dc 100644
--- a/guide/arabic/nodejs/index.md
+++ b/guide/arabic/nodejs/index.md
@@ -19,27 +19,29 @@ Node.js هو وقت تشغيل جافا سكريبت مبني على محرك ج
**الثعبان**
- `import time
-
- def my_io_task():
- time.sleep(5)
- print("done")
-
- my_io_task()
- my_io_task()
-`
+```python
+import time
+
+def my_io_task():
+ time.sleep(5)
+ print("done")
+
+my_io_task()
+my_io_task()
+```
**نود.جي إس**
- `function my_io_task() {
- setTimeout(function() {
- console.log('done');
- }, 5000);
- }
-
- my_io_task();
- my_io_task();
-`
+```node
+function my_io_task() {
+ setTimeout(function() {
+ console.log('done');
+ }, 5000);
+}
+
+my_io_task();
+my_io_task();
+```
كلاهما يشبهان لكن الوقت المستغرق في التنفيذ مختلفان. يستغرق رمز python 10 ثوانٍ لتنفيذ بينما يستغرق رمز Node.js 5 ثوانٍ فقط للتنفيذ.
diff --git a/guide/arabic/nodejs/npm/index.md b/guide/arabic/nodejs/npm/index.md
index 828c43c7c6..c29f91bc73 100644
--- a/guide/arabic/nodejs/npm/index.md
+++ b/guide/arabic/nodejs/npm/index.md
@@ -12,9 +12,10 @@ localeTitle: الآلية الوقائية الوطنية
لتثبيت `npm` لدينا لتنزيل ثنائيات Nodejs في envrionment المحلي. تتضمن ثنائيات Node.js أحدث إصدار من npm. للتحقق من ذلك:
- `npm -v
- 5.6.0
-`
+```shell
+npm -v
+5.6.0
+```
يوفر مدير حزمة العقدة (NPM) وظيفتين رئيسيتين -
@@ -31,44 +32,49 @@ localeTitle: الآلية الوقائية الوطنية
ستصبح أي حزم مثبتة عالميًا متوفرة من سطر الأوامر. نستخدم العلامة --global أو g لتثبيت الحزم عالمياً.
- `$ npm install uglify-js --global
-`
+```shell
+$ npm install uglify-js --global
+```
يمكننا سرد الحزم العالمية التي قمنا بتثبيتها باستخدام الأمر list npm.
- `$ npm list --global
- /usr/local/lib
- ├─┬ npm@5.6.0
- │ ├── abbrev@1.1.0
- │ ├── ansi-regex@2.1.1
- │ ├── ansicolors@0.3.2
- │ ├── ansistyles@0.1.3
- ....................
- └─┬ uglify-js@3.0.15
- ├─┬ commander@2.9.0
- │ └── graceful-readlink@1.0.1
- └── source-map@0.5.6
-`
+```shell
+$ npm list --global
+/usr/local/lib
+├─┬ npm@5.6.0
+│ ├── abbrev@1.1.0
+│ ├── ansi-regex@2.1.1
+│ ├── ansicolors@0.3.2
+│ ├── ansistyles@0.1.3
+....................
+└─┬ uglify-js@3.0.15
+ ├─┬ commander@2.9.0
+ │ └── graceful-readlink@1.0.1
+ └── source-map@0.5.6
+```
ومع ذلك ، فإن المخرجات مطولة نوعًا ما. يمكننا تغيير ذلك مع الخيار --depth = 0.
- `$ npm list -g --depth=0
- /usr/local/lib
- ├── npm@5.6.0
- └── uglify-js@3.0.15
-`
+```js
+$ npm list -g --depth=0
+/usr/local/lib
+├── npm@5.6.0
+└── uglify-js@3.0.15
+```
### تثبيت الحزم في الوضع المحلي
عند تثبيت الحزم محليًا ، فأنت تفعل ذلك عادةً باستخدام ملف package.json.
- `npm install --save express
-`
+```shell
+npm install --save express
+```
الآن يمكنك استخدام هذه الوحدة في ملف js الخاص بك كما يلي
- `const express = require('express');
-`
+```js
+const express = require('express');
+```
وتنقسم الوحدات المحلية الى مزيد من نوعين من depenedencies: `devDepenednecies` و `dependencies` . الفرق بين هذين ، هو أن devDependencies هي وحدات مطلوبة فقط أثناء التطوير ، في حين أن التبعيات هي وحدات مطلوبة أيضا في وقت التشغيل. لحفظ تبعية باعتبارها devDependency على التثبيت ، نحتاج إلى القيام `npm install --save-dev` ، بدلاً من مجرد `npm install --save` .
@@ -78,8 +84,9 @@ localeTitle: الآلية الوقائية الوطنية
للقيام بذلك ، نذكر إصدار الحزمة الذي نريد تثبيته.
- `$ npm install underscore@1.8.2 -S
-`
+```shell
+$ npm install underscore@1.8.2 -S
+```
لإزالة تبعية عمومية ، استخدم `-g` flag.
@@ -87,8 +94,9 @@ localeTitle: الآلية الوقائية الوطنية
npm هو مدير حزم لذا يجب أن يكون قادرًا على إزالة حزمة. يمكننا إزالة الحزمة:
- `$ npm uninstall underscore -S
-`
+```shell
+$ npm uninstall underscore -S
+```
لتحديث تبعية عالمية ، استخدم `-g` flag.
@@ -96,16 +104,18 @@ npm هو مدير حزم لذا يجب أن يكون قادرًا على إزا
لتحديث حزمة ، يمكنك القيام بما يلي:
- `$ npm update underscore -S
-`
+```
+$ npm update underscore -S
+```
للتحقق مما إذا كان هناك تحديث متوفر لأي حزمة مرتبطة بمشروعنا:
- `$ npm outdated
-
- Package Current Wanted Latest Location
- underscore 1.8.2 1.8.3 1.8.3 project
-`
+```shell
+$ npm outdated
+
+Package Current Wanted Latest Location
+underscore 1.8.2 1.8.3 1.8.3 project
+```
يعرض العمود الحالي لنا الإصدار المثبت محليًا. يخبرنا العمود الأحدث بأحدث إصدار من الحزمة. يخبرنا العمود "مطلوب" بأحدث إصدار من الحزمة التي يمكننا الترقية إليها دون كسر الشفرة الحالية.
@@ -115,17 +125,18 @@ npm هو مدير حزم لذا يجب أن يكون قادرًا على إزا
عند تثبيت الحزم محليًا ، فإنك تحتاج إلى ملف package.json. لتوليد واحدة يمكنك القيام بذلك باستخدام الأمر `npm init` . سيؤدي ذلك إلى طرح بعض الأسئلة عن طريق الضغط على Enter يمكنك الاحتفاظ بالقيم الافتراضية.
- `$ npm init
- package name: (project)
- version: (1.0.0)
- description: Demo of package.json
- entry point: (index.js)
- test command:
- git repository:
- keywords:
- author:
- license: (ISC)
-`
+```shell
+$ npm init
+package name: (project)
+version: (1.0.0)
+description: Demo of package.json
+entry point: (index.js)
+test command:
+git repository:
+keywords:
+author:
+license: (ISC)
+```
فكر في `package.json` باعتباره حارس جميع التبعيات أو مظاهر مشروع Node.js. إذا كنت تريد طريقة أسرع لإنشاء ملف package.json استخدم `npm init --y` .
@@ -162,146 +173,157 @@ npm هو مدير حزم لذا يجب أن يكون قادرًا على إزا
مثال:
- `{
- "name": "express",
- "description": "Fast, unopinionated, minimalist web framework",
- "version": "4.11.2",
- "author": {
-
- "name": "TJ Holowaychuk",
- "email": "tj@vision-media.ca"
- },
-
- "contributors": [{
- "name": "Aaron Heckmann",
- "email": "aaron.heckmann+github@gmail.com"
- },
-
- ],
- "license": "MIT", "repository": {
- "type": "git",
- "url": "https://github.com/strongloop/express"
- },
- "homepage": "https://expressjs.com/", "keywords": [
- "express",
- "framework",
- "sinatra",
- "web",
- "rest",
- "restful",
- "router",
- "app",
- "api"
- ],
- "dependencies": {
- "serve-static": "~1.8.1",
-
- },
- "devDependencies": {
- "jade": "~1.9.1",
- },
- "engines": {
- "node": ">= 0.10.0"
- },
- "files": [
- "LICENSE",
- "History.md",
- "Readme.md",
- "index.js",
- "lib/"
- ],
- "scripts": {
- "test": "mocha --require test/support/env
- --reporter spec --bail --check-leaks test/ test/acceptance/",
- "test-cov": "istanbul cover node_modules/mocha/bin/_mocha
- -- --require test/support/env --reporter dot --check-leaks test/ test/acceptance/",
- "test-tap": "mocha --require test/support/env
- --reporter tap --check-leaks test/ test/acceptance/",
- "test-travis": "istanbul cover node_modules/mocha/bin/_mocha
- --report lcovonly -- --require test/support/env
- --reporter spec --check-leaks test/ test/acceptance/"
- },
-
- }
-`
+```json
+{
+ "name": "express",
+ "description": "Fast, unopinionated, minimalist web framework",
+ "version": "4.11.2",
+ "author": {
+
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+
+ "contributors": [{
+ "name": "Aaron Heckmann",
+ "email": "aaron.heckmann+github@gmail.com"
+ },
+
+ ],
+ "license": "MIT", "repository": {
+ "type": "git",
+ "url": "https://github.com/strongloop/express"
+ },
+ "homepage": "https://expressjs.com/", "keywords": [
+ "express",
+ "framework",
+ "sinatra",
+ "web",
+ "rest",
+ "restful",
+ "router",
+ "app",
+ "api"
+ ],
+ "dependencies": {
+ "serve-static": "~1.8.1",
+
+ },
+ "devDependencies": {
+ "jade": "~1.9.1",
+ },
+ "engines": {
+ "node": ">= 0.10.0"
+ },
+ "files": [
+ "LICENSE",
+ "History.md",
+ "Readme.md",
+ "index.js",
+ "lib/"
+ ],
+ "scripts": {
+ "test": "mocha --require test/support/env
+ --reporter spec --bail --check-leaks test/ test/acceptance/",
+ "test-cov": "istanbul cover node_modules/mocha/bin/_mocha
+ -- --require test/support/env --reporter dot --check-leaks test/ test/acceptance/",
+ "test-tap": "mocha --require test/support/env
+ --reporter tap --check-leaks test/ test/acceptance/",
+ "test-travis": "istanbul cover node_modules/mocha/bin/_mocha
+ --report lcovonly -- --require test/support/env
+ --reporter spec --check-leaks test/ test/acceptance/"
+ },
+
+}
+```
## مخطوطات npm
`npm` البرامج النصية `npm` لأتمتة المهام المتكررة. على سبيل المثال ، بناء مشروعك ، وتقليل ملفات Cascading Style Sheets (CSS) و JavaScript (JS). تُستخدم البرامج النصية أيضًا في حذف الملفات والمجلدات المؤقتة ، إلخ. يمكن تخصيصها ويمكن الوصول إليها عبر كائن `scripts` في `package.json` .
- `{
- "name": "super-cool-package",
- "version": "1.0.0",
- "scripts": {}
- }
-`
+```json
+{
+ "name": "super-cool-package",
+ "version": "1.0.0",
+ "scripts": {}
+}
+```
مثال على أكثر نصوص NPM شيوعًا:
- `"scripts": {
- "start": "node index.js",
- ...
- }
-`
+```json
+"scripts": {
+ "start": "node index.js",
+ ...
+}
+```
## npm الكاش
عندما تقوم npm بتثبيت حزمة فإنها تحتفظ بنسخة ، لذلك في المرة التالية التي ترغب في تثبيت هذه الحزمة ، لا تحتاج إلى الوصول إلى الشبكة. يتم تخزين النسخ مؤقتًا في الدليل .npm في المسار الرئيسي.
- `$ ls ~/.npm
- lodash.zipobject
- log-driver
- log-symbols
- logalot
- logfmt
- loglevel
- long-timeout
- longest
- longest-strea
-`
+```shell
+$ ls ~/.npm
+lodash.zipobject
+log-driver
+log-symbols
+logalot
+logfmt
+loglevel
+long-timeout
+longest
+longest-strea
+```
سيصبح هذا الدليل مزدحمًا مع الحزم القديمة بمرور الوقت ، لذلك من المفيد تنظيفه في بعض الأحيان.
- `$ npm cache clean
-`
+```shell
+$ npm cache clean
+```
## غزل - بديل ل npm
غزل هو أيضا مدير حزمة جافا سكريبت المتقدمة والمحافظة عليها من قبل الفيسبوك. كلاهما يشتركان في أوجه تشابه عالية عندما يتعلق الأمر باستخدامهما. من المفترض أن يكون أسرع في تثبيت التبعيات من npm. لتثبيته:
- `npm install -g yarn
-`
+```shell
+npm install -g yarn
+```
لا ينوي غزل استبدال npm ، أكثر مثل تحسين عليه. ويستخدم نفس ملف package.json ، ويحفظ التبعيات إلى `node_modules/` folder. لتهيئة مشروع ، سوف تستخدم:
- `yarn init
-`
+```shell
+yarn init
+```
### إضافة ، وترقية ، وإزالة التبعيات
إضافة تبعية جديدة أمر سهل ومماثل إلى npm:
- `yarn add [package-name]
-`
+```shell
+yarn add [package-name]
+```
إذا كنت تريد إصدارًا أو علامة حزمة معينة ، فيمكنك القيام بذلك.
- `yarn add express@4.14.1
-`
+```shell
+yarn add express@4.14.1
+```
بالنسبة إلى تبعيات dev ، تبعية الأقران والتبعيات الاختيارية التي تمر بها --dev --peer --optional على التوالي.
- `yarn add gulp --dev
-`
+```shell
+yarn add gulp --dev
+```
سيوفر الجولب تحت devDependencies. لترقية حزمة أو إزالتها ، يمكنك فقط استبدال أمر الإضافة إما بترقية أو إزالة متبوعة باسم الحزمة.
- `# upgrade a gulp from 3.9.1 to version 4
- yarn upgrade gulp@4.0
-
- # remove a gulp
- yarn remove gulp
-`
+```shell
+# upgrade a gulp from 3.9.1 to version 4
+yarn upgrade gulp@4.0
+
+# remove a gulp
+yarn remove gulp
+```
بعد كل عملية تثبيت أو ترقية أو إزالة ، يقوم الغزل بتحديث ملف yarn.lock الذي يتتبع إصدار الحزمة المضبوط المثبت في دليل node\_modules. تم تحديث ميزة مشابهة في npm. الآن هناك `package-lock.json` التي تتصرف بالضبط بنفس الطريقة كما `yarn.lock` في إصدارات أحدث من npm.
diff --git a/guide/arabic/nodejs/process/index.md b/guide/arabic/nodejs/process/index.md
index 12d6600c6e..74789f4141 100644
--- a/guide/arabic/nodejs/process/index.md
+++ b/guide/arabic/nodejs/process/index.md
@@ -6,35 +6,37 @@ localeTitle: كائن العملية
يعد كائن `process` في Node.js كائنًا عموميًا يمكن الوصول إليه داخل أية وحدة نمطية دون الحاجة إلى ذلك. هناك عدد قليل جدًا من الكائنات أو الخصائص العامة المتوفرة في Node.js ، وتكون `process` واحدة منها. وهو مكون أساسي في النظام البيئي Node.js لأنه يوفر مجموعات المعلومات المختلفة حول وقت تشغيل البرنامج. لاستكشاف سوف نستخدم واحدة من خصائصه والتي تسمى `process.versions` . تخبرنا هذه الخاصية بالمعلومات حول إصدار Node.js الذي قمنا بتثبيته. يجب استخدامه مع `-p` flag.
- `$ node -p "process.versions"
-
- # output
- { http_parser: '2.8.0',
- node: '8.11.2',
- v8: '6.2.414.54',
- uv: '1.19.1',
- zlib: '1.2.11',
- ares: '1.10.1-DEV',
- modules: '57',
- nghttp2: '1.29.0',
- napi: '3',
- openssl: '1.0.2o',
- icu: '60.1',
- unicode: '10.0',
- cldr: '32.0',
- tz: '2017c' }
-`
+```shell
+$ node -p "process.versions"
+
+# output
+{ http_parser: '2.8.0',
+ node: '8.11.2',
+ v8: '6.2.414.54',
+ uv: '1.19.1',
+ zlib: '1.2.11',
+ ares: '1.10.1-DEV',
+ modules: '57',
+ nghttp2: '1.29.0',
+ napi: '3',
+ openssl: '1.0.2o',
+ icu: '60.1',
+ unicode: '10.0',
+ cldr: '32.0',
+ tz: '2017c' }
+```
خاصية أخرى يمكنك التحقق منها هي `process.release` التي هي نفسها للأمر `$ node --version` التي استخدمناها عندما قمنا بتثبيت Node.js لكن الإخراج هذه المرة سيكون أكثر تفصيلاً.
- `node -p "process.release"
-
- # output
- { name: 'node',
- lts: 'Carbon',
- sourceUrl: 'https://nodejs.org/download/release/v8.11.2/node-v8.11.2.tar.gz',
- headersUrl: 'https://nodejs.org/download/release/v8.11.2/node-v8.11.2-headers.tar.gz' }
-`
+```shell
+node -p "process.release"
+
+# output
+{ name: 'node',
+ lts: 'Carbon',
+ sourceUrl: 'https://nodejs.org/download/release/v8.11.2/node-v8.11.2.tar.gz',
+ headersUrl: 'https://nodejs.org/download/release/v8.11.2/node-v8.11.2-headers.tar.gz' }
+```
هذه بعض الأوامر المختلفة التي يمكننا استخدامها في سطر الأوامر للوصول إلى المعلومات التي لا يمكن لأي وحدة توفيرها. يعتبر كائن `process` هذا مثالًا لفئة EventEmitter ولا يحتوي على أحداثه المحددة مسبقًا مثل `exit` والتي يمكن استخدامها لمعرفة متى أكمل أحد البرامج في Node.js تنفيذه. تشغيل البرنامج أدناه ويمكنك ملاحظة أن النتيجة تأتي مع رمز الحالة `0` . في Node.js يعني رمز الحالة هذا أن أحد البرامج قد تم تشغيله بنجاح.
@@ -50,9 +52,10 @@ localeTitle: كائن العملية
ناتج البرنامج أعلاه:
- `Execution Completed
- Exited with status code: 0
-`
+```shell
+Execution Completed
+Exited with status code: 0
+```
`Process` توفر أيضا خصائص مختلفة للتفاعل معها. يمكن استخدام بعضها في تطبيق عقدة لتوفير بوابة للتواصل بين تطبيق العقدة وأي واجهة سطر الأوامر. هذا مفيد جدا إذا كنت تقوم ببناء تطبيق سطر الأوامر أو أداة مساعدة باستخدام Node.js
@@ -73,10 +76,11 @@ localeTitle: كائن العملية
إذا قمت بتشغيل التعليمات البرمجية المذكورة أعلاه باستخدام الأمر التالي ستحصل على الإخراج ويتم طباعة العناصر الأولين من `argv` .
- `$ node test.js
-
- # output
- Hello World!
- 0: /usr/local/bin/node
- 1: /Users/amanhimself/Desktop/articles/nodejs-text-tuts/test.js
-`
\ No newline at end of file
+```shell
+$ node test.js
+
+# output
+Hello World!
+0: /usr/local/bin/node
+1: /Users/amanhimself/Desktop/articles/nodejs-text-tuts/test.js
+```
\ No newline at end of file
diff --git a/guide/arabic/nodejs/streams/index.md b/guide/arabic/nodejs/streams/index.md
index 00d9d3ca64..5cd5d89d6b 100644
--- a/guide/arabic/nodejs/streams/index.md
+++ b/guide/arabic/nodejs/streams/index.md
@@ -25,18 +25,20 @@ localeTitle: تيارات
في Node.js ، يتم استخدام `pipe` بنفس الطريقة ، لربط المدخلات والمخرجات من العمليات المختلفة. يتوفر `pipe()` كدالة تأخذ تيار مصدر مقروء وتربط الإخراج إلى تيار وجهة. يمكن تمثيل الصيغة العامة على النحو التالي:
- `src.pipe(dest);
-`
+```javascript
+src.pipe(dest);
+```
يمكن أيضاً ربط الدالات متعددة `pipe()` معاً.
- `a.pipe(b).pipe(c);
-
- // which is equivalent to
-
- a.pipe(b);
- b.pipe(c);
-`
+```javascript
+a.pipe(b).pipe(c);
+
+// which is equivalent to
+
+a.pipe(b);
+b.pipe(c);
+```
### تيارات مقروءة
@@ -62,40 +64,42 @@ localeTitle: تيارات
* الترميز: لتحويل البيانات إلى نموذج قابل للقراءة من قبل الإنسان
* رد الاتصال: دالة يتم استدعاؤها عند الانتهاء من معالجة البيانات من القطعة
- `const { Writable } = require('stream');
- const writable = new Writable({
- write(chunk, encoding, callback) {
- console.log(chunk.toString());
- callback();
- }
- });
-
- process.stdin.pipe(writable);
-`
+```javascript
+const { Writable } = require('stream');
+const writable = new Writable({
+ write(chunk, encoding, callback) {
+ console.log(chunk.toString());
+ callback();
+ }
+});
+
+process.stdin.pipe(writable);
+```
### تيارات دوبلكس
تيارات البث المزدوجة تساعدنا على تنفيذ كل من الدفق القابل للقراءة والكتابة في نفس الوقت.
- `const { Duplex } = require('stream');
-
- const inoutStream = new Duplex({
- write(chunk, encoding, callback) {
- console.log(chunk.toString());
- callback();
- },
-
- read(size) {
- this.push(String.fromCharCode(this.currentCharCode++));
- if (this.currentCharCode > 90) {
- this.push(null);
- }
- }
- });
-
- inoutStream.currentCharCode = 65;
- process.stdin.pipe(inoutStream).pipe(process.stdout);
-`
+```javascript
+const { Duplex } = require('stream');
+
+const inoutStream = new Duplex({
+ write(chunk, encoding, callback) {
+ console.log(chunk.toString());
+ callback();
+ },
+
+ read(size) {
+ this.push(String.fromCharCode(this.currentCharCode++));
+ if (this.currentCharCode > 90) {
+ this.push(null);
+ }
+ }
+});
+
+inoutStream.currentCharCode = 65;
+process.stdin.pipe(inoutStream).pipe(process.stdout);
+```
`stdin` قطار `stdin` البيانات القابلة للقراءة إلى الدفق المزدوج. يساعدنا `stdout` على رؤية البيانات. تعمل الأجزاء القابلة للقراءة والكتابة في الدفق المزدوج بشكل مستقل تمامًا عن بعضها البعض.
@@ -103,17 +107,18 @@ localeTitle: تيارات
هذا النوع من الدفق هو أكثر من إصدار متقدم من الدفق المزدوج.
- `const { Transform } = require('stream');
-
- const upperCaseTr = new Transform({
- transform(chunk, encoding, callback) {
- this.push(chunk.toString().toUpperCase());
- callback();
- }
- });
-
- process.stdin.pipe(upperCaseTr).pipe(process.stdout);
-`
+```javascript
+const { Transform } = require('stream');
+
+const upperCaseTr = new Transform({
+ transform(chunk, encoding, callback) {
+ this.push(chunk.toString().toUpperCase());
+ callback();
+ }
+});
+
+process.stdin.pipe(upperCaseTr).pipe(process.stdout);
+```
البيانات التي نستهلكها هي نفس المثال السابق للدفق المزدوج. إن ما نلاحظه هنا هو أن `transform()` لا يتطلب تنفيذ أساليب `read` أو `write` . يجمع بين كل من الأساليب نفسها.
@@ -121,30 +126,32 @@ localeTitle: تيارات
نظرًا لأن Node.js غير متزامن بحيث يتفاعل من خلال تمرير الاسترجاعات إلى وظائف مع القرص والشبكة. يقرأ المثال الموجود أدناه البيانات من ملف على القرص ويستجيب إلى طلب الشبكة من العميل.
- `const http = require('http');
- const fs = require('fs');
-
- const server = http.createServer((req, res) => {
- fs.readFile('data.txt', (err, data) => {
- res.end(data);
- });
- });
- server.listen(8000);
-`
+```javascript
+const http = require('http');
+const fs = require('fs');
+
+const server = http.createServer((req, res) => {
+ fs.readFile('data.txt', (err, data) => {
+ res.end(data);
+ });
+});
+server.listen(8000);
+```
سيعمل مقتطف الشفرة الموضح أعلاه ولكن البيانات الكاملة من الملف ستدخل أولاً إلى الذاكرة لكل طلب قبل كتابة النتيجة مرة أخرى لطلب العميل. إذا كان الملف الذي نقرأه كبيرًا جدًا ، فقد يصبح هذا اتصالًا للخادم ثقيلًا ومكلفًا للغاية ، حيث سيستهلك الكثير من الذاكرة لعملية التقدم. ستعاني أيضًا تجربة المستخدم على جانب العميل من التأخير.
في هذه الحالة ، إذا استخدمنا الدفق ، سيتم إرسال البيانات إلى طلب العميل كقطعة واحدة في كل مرة بمجرد تلقيها من القرص.
- `const http = require('http');
- const fs = require('fs');
-
- const server = http.createServer((req, res) => {
- const stream = fs.createReadStream('data.txt');
- stream.pipe(res);
- });
- server.listen(8000);
-`
+```javascript
+const http = require('http');
+const fs = require('fs');
+
+const server = http.createServer((req, res) => {
+ const stream = fs.createReadStream('data.txt');
+ stream.pipe(res);
+});
+server.listen(8000);
+```
يعتني `pipe()` هنا بالكتابة أو في حالتنا ، وإرسال البيانات مع كائن الاستجابة وبمجرد قراءة كل البيانات من الملف ، لإغلاق الاتصال.
diff --git a/guide/arabic/php/ajax/index.md b/guide/arabic/php/ajax/index.md
index 9e5b21c941..1f0414f60e 100644
--- a/guide/arabic/php/ajax/index.md
+++ b/guide/arabic/php/ajax/index.md
@@ -27,8 +27,9 @@ localeTitle: AJAX
**إنشاء كائن XMLHttpRequest:**
- `var xhttp = new XMLHttpRequest();
-`
+```javascript
+var xhttp = new XMLHttpRequest();
+```
**خصائص كائن XMLHttpRequest:**
@@ -50,52 +51,55 @@ localeTitle: AJAX
**أساليب كائن XMLHttpRequest:** لإرسال طلب إلى خادم ويب ، نستخدم الأساليب open () و send () للكائن XMLHttpRequest.
- `xhttp.open("GET", "content.txt", true);
- xhttp.send();
-`
+```javascript
+xhttp.open("GET", "content.txt", true);
+xhttp.send();
+```
**إنشاء تغيير وظيفةContent () باستخدام JavaScript:**
- `function changeContent() {
- var xhttp = new XMLHttpRequest();
- xhttp.onreadystatechange = function() {
- if (this.readyState == 4 && this.status == 200) {
- document.getElementById("foo").innerHTML = this.responseText;
- }
- };
- xhttp.open("GET", "content.txt", true);
- xhttp.send();
- }
-`
+```javascript
+function changeContent() {
+ var xhttp = new XMLHttpRequest();
+ xhttp.onreadystatechange = function() {
+ if (this.readyState == 4 && this.status == 200) {
+ document.getElementById("foo").innerHTML = this.responseText;
+ }
+ };
+ xhttp.open("GET", "content.txt", true);
+ xhttp.send();
+}
+```
**مثال AJAX لتغيير محتوى صفحة الويب:**
- `
-
-
-
-
-
The XMLHttpRequest Object
-
-
-
-
-
-
-
-`
+```HTML
+
+
+
+
+
+
The XMLHttpRequest Object
+
+
+
+
+
+
+
+```
يجب أن يكون الملف `content.txt` موجودًا في الدليل الجذر لتطبيق الويب.
diff --git a/guide/arabic/php/array/index.md b/guide/arabic/php/array/index.md
index 391025f27c..262547e03d 100644
--- a/guide/arabic/php/array/index.md
+++ b/guide/arabic/php/array/index.md
@@ -8,12 +8,13 @@ localeTitle: مجموعة مصفوفة
هنا مثال:
- `
-`
+```
+
+```
مجموعة PHP لديها العديد من الوظائف للعمل بها. هنا هو كل قائمة تم فرزها: [وظائف](https://www.w3schools.com/php/php_ref_array.asp)
@@ -23,13 +24,14 @@ localeTitle: مجموعة مصفوفة
هذا مثال بسيط:
- ` "bar",
- "bar" => "foo",
- );
-
- echo $array['bar'];
-`
+```
+ "bar",
+ "bar" => "foo",
+);
+
+echo $array['bar'];
+```
أتمنى لك يومًا سعيدًا وترميزًا سعيدًا !!!
\ No newline at end of file
diff --git a/guide/arabic/php/arrays/index.md b/guide/arabic/php/arrays/index.md
index 21c0a4d0df..ec39adfa1e 100644
--- a/guide/arabic/php/arrays/index.md
+++ b/guide/arabic/php/arrays/index.md
@@ -12,9 +12,10 @@ localeTitle: المصفوفات
صفيف مفهرسة يصل إلى الكائنات حسب رقم الفهرس.
- `"0","code"=>"1","camp"=>"2");
-`
+```PHP
+"0","code"=>"1","camp"=>"2");
+```
`$freecodecamp['free']` سيعود "0" ، `$freecodecamp['code']` سيعود "1" ، `$freecodecamp['camp']` سيعود "2" ،
@@ -32,9 +34,10 @@ localeTitle: المصفوفات
المصفوفة متعددة الأبعاد هي مصفوفة تحتوي على صفائف أخرى.
- `"0","code"=>"1","camp"=>"2"),array("free"=>"0","code"=>"1","camp"=>"2"),array("free"=>"0","code"=>"1","camp"=>"2"));
-`
+```PHP
+"0","code"=>"1","camp"=>"2"),array("free"=>"0","code"=>"1","camp"=>"2"),array("free"=>"0","code"=>"1","camp"=>"2"));
+```
#### معلومات اكثر:
diff --git a/guide/arabic/php/arrays/sorting-arrays/index.md b/guide/arabic/php/arrays/sorting-arrays/index.md
index 08a7ec1e96..dcf1395fda 100644
--- a/guide/arabic/php/arrays/sorting-arrays/index.md
+++ b/guide/arabic/php/arrays/sorting-arrays/index.md
@@ -10,121 +10,133 @@ localeTitle: فرز المصفوفات
تقوم الدالة `sort()` بفرز قيم صفيف بترتيب أبجدي / رقمي تصاعدي (على سبيل المثال A ، B ، C ، D ، E… 5 ، 4 ، 3 ، 2 ، 1 ...)
- ` camp
- [1] => code
- [2] => free
- )
-`
+```text
+Array
+(
+ [0] => camp
+ [1] => code
+ [2] => free
+)
+```
### rsort ()
تقوم `rsort()` بفرز قيم صفيف في ترتيب أبجدي / رقمي تنازلي (Eg Z، Y، X، W، V… 5، 4، 3، 2، 1…)
- ` free
- [1] => code
- [2] => camp
- )
-`
+```text
+Array
+(
+ [0] => free
+ [1] => code
+ [2] => camp
+)
+```
### asort ()
تقوم الدالة `asort()` بفرز مصفوفة ارتباطية ، حسب قيمها ، بترتيب أبجدي / رقمي تصاعدي (على سبيل المثال A ، B ، C ، D ، E… 5 ، 4 ، 3 ، 2 ، 1 ...)
- `"free", "one"=>"code", "two"=>"camp");
- asort($freecodecamp);
- print_r($freecodecamp);
-`
+```PHP
+"free", "one"=>"code", "two"=>"camp");
+asort($freecodecamp);
+print_r($freecodecamp);
+```
**انتاج:**
- `Array
- (
- [two] => camp
- [one] => code
- [zero] => free
- )
-`
+```text
+Array
+(
+ [two] => camp
+ [one] => code
+ [zero] => free
+)
+```
### ksort ()
تقوم `ksort()` بترتيب مصفوفة `ksort()` ، حسب مفاتيحها ، بترتيب أبجدي / رقمي تصاعدي (على سبيل المثال A ، B ، C ، D ، E… 5 ، 4 ، 3 ، 2 ، 1 ...)
- `"free", "one"=>"code", "two"=>"camp");
- ksort($freecodecamp);
- print_r($freecodecamp);
-`
+```PHP
+"free", "one"=>"code", "two"=>"camp");
+ksort($freecodecamp);
+print_r($freecodecamp);
+```
**انتاج:**
- `Array
- (
- [one] => code
- [two] => camp
- [zero] => free
- )
-`
+```text
+Array
+(
+ [one] => code
+ [two] => camp
+ [zero] => free
+)
+```
### arsort ()
تقوم `arsort()` بترتيب مصفوفة `arsort()` ، حسب قيمها ، بترتيب أبجدي / رقمي تنازلي (Eg Z ، Y ، X ، W ، V… 5 ، 4 ، 3 ، 2 ، 1 ...)
- `"free", "one"=>"code", "two"=>"camp");
- arsort($freecodecamp);
- print_r($freecodecamp);
-`
+```PHP
+"free", "one"=>"code", "two"=>"camp");
+arsort($freecodecamp);
+print_r($freecodecamp);
+```
**انتاج:**
- `Array
- (
- [zero] => free
- [one] => code
- [two] => camp
- )
-`
+```text
+Array
+(
+ [zero] => free
+ [one] => code
+ [two] => camp
+)
+```
### krsort ()
تقوم `krsort()` بترتيب مصفوفة `krsort()` ، من خلال مفاتيحها في ترتيب أبجدي / رقمي تنازلي (Eg Z ، Y ، X ، W ، V… 5 ، 4 ، 3 ، 2 ، 1 ...)
- `"free", "one"=>"code", "two"=>"camp");
- krsort($freecodecamp);
- print_r($freecodecamp);
-`
+```PHP
+"free", "one"=>"code", "two"=>"camp");
+krsort($freecodecamp);
+print_r($freecodecamp);
+```
**انتاج:**
- `Array
- (
- [zero] => free
- [two] => camp
- [one] => code
- )
-`
+```text
+Array
+(
+ [zero] => free
+ [two] => camp
+ [one] => code
+)
+```
#### معلومات اكثر:
diff --git a/guide/arabic/php/basic-syntax/index.md b/guide/arabic/php/basic-syntax/index.md
index 4677db5b52..f72e4f4778 100644
--- a/guide/arabic/php/basic-syntax/index.md
+++ b/guide/arabic/php/basic-syntax/index.md
@@ -14,19 +14,21 @@ localeTitle: بناء الجملة الأساسي
# أول صفحة PHP
- `The output of that would be :
-`
+```
+The output of that would be :
+```
أول صفحة PHP
مرحبا بالعالم!
- `#### Note: PHP statements end with a semicolon (;).
-
- # Comments in PHP
-
- PHP supports several ways of commenting:
-`
+```
+#### Note: PHP statements end with a semicolon (;).
+
+# Comments in PHP
+
+PHP supports several ways of commenting:
+```
`# PHP Case Sensitivity
@@ -35,9 +37,10 @@ localeTitle: بناء الجملة الأساسي
In the example below, all three echo statements below are legal (and equal):
`
- `### However; all variable names are case-sensitive.
-
- In the example below, only the first statement will display the value of the $color variable (this is because $color, $COLOR, and $coLOR are treated as three different variables):
-`
+```
+### However; all variable names are case-sensitive.
+
+In the example below, only the first statement will display the value of the $color variable (this is because $color, $COLOR, and $coLOR are treated as three different variables):
+```
\`\` \`\`
\ No newline at end of file
diff --git a/guide/arabic/php/class-inheritance/index.md b/guide/arabic/php/class-inheritance/index.md
index ff1250c13c..f742438417 100644
--- a/guide/arabic/php/class-inheritance/index.md
+++ b/guide/arabic/php/class-inheritance/index.md
@@ -87,55 +87,59 @@ _إعادة تسمية الكود مع الميراث في البرمجة الم
بدون الاضطرار إلى إعادة كتابة جميع الرموز الخاصة بفئة `Man` ، يمكننا إعادة استخدام هذا الرمز باستخدام الكلمة الأساسية الممتدة.
- ` Our man's name is: Jackie
- // => He is 25 years old and 5' 5" tall.
-`
+```php
+ Our man's name is: Jackie
+// => He is 25 years old and 5' 5" tall.
+```
يمكننا المضي قدمًا ووضع رياضة ومشروبات HealthyMan aka aka المفضلة.
- `fav_sports = ['swimming', 'weight training'];
- print_r($jackie->fav_sports);
- // =>
- // Array
- // (
- // [0] => swimming
- // [1] => weight training
- // )
-
- $jackie->setFavDrinks(['Matcha tea', 'Oolong Tea']);
- print_r($jackie->getFavDrinks());
- // =>
- // Array
- // (
- // [0] => Matcha tea
- // [1] => Oolong Tea
- // )
-`
+```php
+fav_sports = ['swimming', 'weight training'];
+print_r($jackie->fav_sports);
+// =>
+// Array
+// (
+// [0] => swimming
+// [1] => weight training
+// )
+
+$jackie->setFavDrinks(['Matcha tea', 'Oolong Tea']);
+print_r($jackie->getFavDrinks());
+// =>
+// Array
+// (
+// [0] => Matcha tea
+// [1] => Oolong Tea
+// )
+```
الآن دعنا نرى ما إذا كان باستطاعتنا الاتصال بطرق `giveFirmHandshakes()` الرجل مثل `giveFirmHandshakes()` و `beStubborn()` و `notPutToiletPaper()` .
- `giveFirmHandshakes();
- // => I give firm handshakes.
-
- echo "\n" . $jackie->beStubborn();
- // => I am stubborn.
-
- echo "\n" . $jackie->notPutToiletPaper();
- // => It's not humanly possible to remember to put toilet paper rolls when they are finished
-`
+```php
+giveFirmHandshakes();
+// => I give firm handshakes.
+
+echo "\n" . $jackie->beStubborn();
+// => I am stubborn.
+
+echo "\n" . $jackie->notPutToiletPaper();
+// => It's not humanly possible to remember to put toilet paper rolls when they are finished
+```
نحصل على كل هذه الأشياء من خلال مجرد ترميز فئة رجل باستخدام الكلمة الأساسية الممتدة.
@@ -201,25 +205,26 @@ _إعادة تسمية الكود مع الميراث في البرمجة الم
يمكننا استدعاء هذه الطرق لمعرفة ما إذا كانت تعمل كما هو متوقع:
- `eatHealthy();
- // => I only eat healthy meals.
-
- echo "\n" . $jackie->meditateDaily();
- // => I set aside 20 minutes daily to meditate.
-
- echo "\n" . $jackie->laughOften();
- // => I watch funny TV shows to unwind myself.
-
- $jackie->setBodyFatPercentage(12);
- echo "\nBody Fat %: " . $jackie->getBodyFatPercentage();
- // => Body Fat %: 12
-
- $jackie->setWorkoutPerWeek(5);
- echo "\nWorkout Times Per Week: " . $jackie->getWorkoutPerWeek();
- // => Workout Times Per Week: 5
-`
+```php
+eatHealthy();
+// => I only eat healthy meals.
+
+echo "\n" . $jackie->meditateDaily();
+// => I set aside 20 minutes daily to meditate.
+
+echo "\n" . $jackie->laughOften();
+// => I watch funny TV shows to unwind myself.
+
+$jackie->setBodyFatPercentage(12);
+echo "\nBody Fat %: " . $jackie->getBodyFatPercentage();
+// => Body Fat %: 12
+
+$jackie->setWorkoutPerWeek(5);
+echo "\nWorkout Times Per Week: " . $jackie->getWorkoutPerWeek();
+// => Workout Times Per Week: 5
+```
لقد نجحنا في إعادة استخدام الشفرة الحالية ونفذنا برنامجًا دراسيًا للأطفال.
@@ -227,28 +232,30 @@ _إعادة تسمية الكود مع الميراث في البرمجة الم
على الرغم من أنه ورث عن `beStubborn()` من فئة Man ، حيث أن Jackie رجل سليم ، فهو عنيد فقط مرة واحدة فقط في فترة. يمكننا أن نحصل على `beStubborn()` " `beStubborn()` Healthy Man's `beStubborn()` " ليقول "أنا عنيد من حين `beStubborn()` " بدلاً من "أنا عنيد" فقط عن طريق تجاوز أسلوب "الطبقة الأم".
- `beStubborn();
- // => I am stubborn once in a while.
-`
+```php
+beStubborn();
+// => I am stubborn once in a while.
+```
يوضح هذا كيف يعمل overriding الأسلوب في OOP.
diff --git a/guide/arabic/php/class/index.md b/guide/arabic/php/class/index.md
index c5c4b682f2..32e0e341f3 100644
--- a/guide/arabic/php/class/index.md
+++ b/guide/arabic/php/class/index.md
@@ -4,25 +4,26 @@ localeTitle: PHP - الصف
---
### فئة بسيطة للمبتدئين!
- `class Lab {
- private $name = '';
-
- public function setName($name) {
- $this->name = $name;
- }
-
- private function getName() {
- return $this->name;
- }
-
- public function say_my_name() {
- $name = $this->getName();
- return $name;
- }
-
- }
- $breaking_bad = 'Heisenberg';
- $lab = new Lab();
- $lab->setName($breaking_bad);
- echo "My Name is " . $lab->say_my_name(). "!";
-`
\ No newline at end of file
+```php
+class Lab {
+ private $name = '';
+
+ public function setName($name) {
+ $this->name = $name;
+ }
+
+ private function getName() {
+ return $this->name;
+ }
+
+ public function say_my_name() {
+ $name = $this->getName();
+ return $name;
+ }
+
+}
+$breaking_bad = 'Heisenberg';
+$lab = new Lab();
+$lab->setName($breaking_bad);
+echo "My Name is " . $lab->say_my_name(). "!";
+```
\ No newline at end of file
diff --git a/guide/arabic/php/conditionals/index.md b/guide/arabic/php/conditionals/index.md
index 984363416b..90e5da327e 100644
--- a/guide/arabic/php/conditionals/index.md
+++ b/guide/arabic/php/conditionals/index.md
@@ -8,33 +8,36 @@ localeTitle: الشرطية
### إذا
- `
-`
+```
+= "freeCodeCamp"; ?>
+```
### طباعة
تعمل وظيفة `print()` خارج قيمة متغير أو وسيطة على الشاشة.
- `` :
- `
-`
+```php
+
+```
أو يمكنك أيضًا كتابة برنامج نصي PHP يبدأ بـ `` :
- `
-
-
-
-
-
-
-
-`
\ No newline at end of file
+```php
+
+
+
+
+
+
+
+
+```
\ No newline at end of file
diff --git a/guide/arabic/php/index.md b/guide/arabic/php/index.md
index d5ca8f2811..756e78b02a 100644
--- a/guide/arabic/php/index.md
+++ b/guide/arabic/php/index.md
@@ -48,18 +48,21 @@ PHP هي لغة مفسرة. هذا يعني أنه عند إجراء تغيير
على توزيعات جنو / لينكس القائمة على ديبيان ، يمكنك التثبيت من خلال:
- `sudo apt install php
-`
+```bash
+sudo apt install php
+```
بعد التثبيت ، يمكنك تشغيل أي ملفات PHP ببساطة عن طريق القيام بذلك في المحطة الطرفية:
- `php file.php
-`
+```
+php file.php
+```
يمكنك أيضًا تثبيت خادم localhost لتشغيل مواقع PHP على الويب. لتثبيت Apache Web Server:
- `sudo apt install apache2 libapache2-mod-php
-`
+```
+sudo apt install apache2 libapache2-mod-php
+```
## ماذا يمكن أن تفعل PHP؟
diff --git a/guide/arabic/php/loop/index.md b/guide/arabic/php/loop/index.md
index f5f4737ad5..36124dc782 100644
--- a/guide/arabic/php/loop/index.md
+++ b/guide/arabic/php/loop/index.md
@@ -19,30 +19,33 @@ localeTitle: عقدة
## بناء الجملة
- `for (init counter; condition; counter increment or decrement)
- {
- // Code to be executed
- }
-`
+```
+for (init counter; condition; counter increment or decrement)
+{
+ // Code to be executed
+}
+```
## مثال
- `
-`
+```php
+
+```
## انتاج |
- `> Current loop counter 0.
- > Current loop counter 1.
- > Current loop counter 2.
- > Current loop counter 3.
- > Current loop counter 4.
-`
+```
+> Current loop counter 0.
+> Current loop counter 1.
+> Current loop counter 2.
+> Current loop counter 3.
+> Current loop counter 4.
+```
# حائط اللوب
@@ -50,38 +53,41 @@ localeTitle: عقدة
## بناء الجملة
- `while (condition)
- {
- // Code to be executed
- }
-`
+```
+while (condition)
+{
+ // Code to be executed
+}
+```
## مثال
- `= 0)
- {
- echo "The index is ".$index.".\n";
- $index--;
- }
- ?>
-`
+```php
+= 0)
+{
+ echo "The index is ".$index.".\n";
+ $index--;
+}
+?>
+```
## انتاج |
- `> The index is 10.
- > The index is 9.
- > The index is 8.
- > The index is 7.
- > The index is 6.
- > The index is 5.
- > The index is 4.
- > The index is 3.
- > The index is 2.
- > The index is 1.
- > The index is 0.
-`
+```
+> The index is 10.
+> The index is 9.
+> The index is 8.
+> The index is 7.
+> The index is 6.
+> The index is 5.
+> The index is 4.
+> The index is 3.
+> The index is 2.
+> The index is 1.
+> The index is 0.
+```
# هل ... في حين حلقة
@@ -89,33 +95,36 @@ localeTitle: عقدة
## بناء الجملة
- `do
- {
- // Code to be executed
- }
- while (condition);
-`
+```
+do
+{
+ // Code to be executed
+}
+while (condition);
+```
## مثال
- ` 0);
- ?>
-`
+```php
+ 0);
+?>
+```
## انتاج |
- `> Index: 3.
- > Index: 2.
- > Index: 1.
-`
+```
+> Index: 3.
+> Index: 2.
+> Index: 1.
+```
# حلقة foreach
@@ -123,11 +132,12 @@ localeTitle: عقدة
## بناء الجملة
- `foreach ($array as $value)
- {
- // Code to be executed
- }
-`
+```
+foreach ($array as $value)
+{
+ // Code to be executed
+}
+```
## مثال
@@ -150,11 +160,12 @@ localeTitle: عقدة
## انتاج |
- `> Hi, my name is Ali.
- > Hi, my name is Ah Kao.
- > Hi, my name is Muthu.
- > Hi, my name is Gwen.
- > Hi, my name is Lucida.
- > Hi, my name is Cecily.
- > "Hello, Cecily!"
-`
\ No newline at end of file
+```
+> Hi, my name is Ali.
+> Hi, my name is Ah Kao.
+> Hi, my name is Muthu.
+> Hi, my name is Gwen.
+> Hi, my name is Lucida.
+> Hi, my name is Cecily.
+> "Hello, Cecily!"
+```
\ No newline at end of file
diff --git a/guide/arabic/php/loops/for-loop/index.md b/guide/arabic/php/loops/for-loop/index.md
index 59fdeaf6ed..cbe1c9b469 100644
--- a/guide/arabic/php/loops/for-loop/index.md
+++ b/guide/arabic/php/loops/for-loop/index.md
@@ -40,19 +40,21 @@ localeTitle: لحلقة
عند الفهرسة عبر مصفوفة عدة مرات ، من السهل تجاوز حدود الصفيف (على سبيل المثال ، حاول أن ترجع العنصر الرابع في صفيف مكون من 3 عناصر).
- `// This will cause an error.
- // The bounds of the array will be exceeded.
- $arr = array(1,2,3);
-
- for ($i = 0; $i <= count($arr); $i++) {
- var_dump($arr[$i]);
- }
-`
+```php
+// This will cause an error.
+// The bounds of the array will be exceeded.
+$arr = array(1,2,3);
+
+for ($i = 0; $i <= count($arr); $i++) {
+ var_dump($arr[$i]);
+}
+```
هذا سوف يخرج:
- `int(1) int(2) int(3) NULL
-`
+```txt
+int(1) int(2) int(3) NULL
+```
هناك طرق لإصلاح هذا الرمز.
@@ -64,9 +66,10 @@ localeTitle: لحلقة
لحل هذه المشكلة ، من الممكن وضع حجم الصفيف في متغير.
- `//create the $size variable with a second expression comma separated
- for ($i = 0, $size = count($arr); $i < $size; ++$i) {
-`
+```php
+//create the $size variable with a second expression comma separated
+for ($i = 0, $size = count($arr); $i < $size; ++$i) {
+```
### معلومات اكثر
diff --git a/guide/arabic/php/loops/while-loop/index.md b/guide/arabic/php/loops/while-loop/index.md
index beaf6b718b..4b3e5716ba 100644
--- a/guide/arabic/php/loops/while-loop/index.md
+++ b/guide/arabic/php/loops/while-loop/index.md
@@ -6,17 +6,19 @@ localeTitle: حائط اللوب
تعد `while loop` واحدة من أسهل أنواع الحلقات في PHP. ينفذ كتلة البيانات حتى يتم تقييم التعبير إلى **TRUE** . إذا تغيرت قيمة التعبير في وقت التنفيذ ، فستعمل الحلقة حتى يتم تقييم التعبير إلى **FALSE** . يتم إعطاء النموذج الأساسي لحلقة While أدناه:
- `while (expr)
- statement
-`
+```shell
+while (expr)
+ statement
+```
يمكن تضمين البيانات داخل الحلقة أثناء الأقواس المعقوفة أو يمكن استخدامها بناء على الصيغة التالية:
- `while (expr):
- statement
- ...
- endwhile;
-`
+```shell
+while (expr):
+ statement
+ ...
+endwhile;
+```
توضيح بناء الجملة البسيط والبديل من حلقة أثناء استخدام المثال:
diff --git a/guide/arabic/php/object-oriented-programming/index.md b/guide/arabic/php/object-oriented-programming/index.md
index 6962f05b0a..27d82dff9d 100644
--- a/guide/arabic/php/object-oriented-programming/index.md
+++ b/guide/arabic/php/object-oriented-programming/index.md
@@ -16,32 +16,33 @@ localeTitle: البرمجة الشيئية
مع وضع هذه الأمور في الاعتبار ، لم يعد إنشاء فئة رجل أمرًا صعبًا بعد الآن. لذا ، سيذهب البرنامج هكذا.
- `name . "\n";
- echo "He is " . $jack->age . " years old and " . $jack->height . " tall.";
-`
+```php
+name . "\n";
+echo "He is " . $jack->age . " years old and " . $jack->height . " tall.";
+```
هذا هو المكان الصانعين يلعبون. إن المنشئات هي أساليب خاصة يتم استدعائها عند إنشاء كائن.
لذا ، فإن الفكرة هي طباعة اسم جاك وعمرها وارتفاعها عندما نقوم بإنشاء كائن "جاك" عن طريق إنشاء دروس للإنسان. ولتحقيق ذلك ، نحتاج إلى تحديد الاسم والعمر والطول عند إنشاء الكائن على النحو التالي:
- `name;
- echo $jack->height;
-`
+```php
+name;
+echo $jack->height;
+```
ولكن ماذا لو أردنا أن نبقي بعض الأمور سرية عن الرجل؟ ربما لا يريد أن يعرف الجميع سنه ... أو ... ربما يريد فقط بعض الأشخاص أن يعرفوا مشروباته المفضلة. يمكننا تحقيق ذلك عن طريق تغيير مستوى رؤية هذه الخصائص من العامة إلى المحمية وحتى الخاصة.
@@ -233,31 +238,33 @@ localeTitle: البرمجة الشيئية
سنتحدث عن وراثة فصل في وقت ما. في الوقت الحالي ، دعنا نحاول تعيين فئة العمر محمية و private\_drinks خاصة في فئة Man.
- `age;
- // Fatal error: Cannot access protected property Man::$age
-
- print_r($jack->fav_drinks);
- // Fatal error: Cannot access private property Man::$fav_drinks
-`
+```php
+age;
+// Fatal error: Cannot access protected property Man::$age
+
+print_r($jack->fav_drinks);
+// Fatal error: Cannot access private property Man::$fav_drinks
+```
### المحددات والرسومات
@@ -265,12 +272,13 @@ localeTitle: البرمجة الشيئية
للحصول على الخصائص المحمية أو الخاصة ، نحتاج إلى إنشاء طريقة getter مثل هذا داخل فئة Man (لاحظ أن هذه طريقة للفصل مع ظهور للجمهور).
- `age;
- }
-`
+```php
+age;
+}
+```
الآن يمكننا بسهولة الحصول على عمر جاك عن طريق استدعاء هذه الطريقة:
@@ -312,9 +320,10 @@ echo $ jack-> getAge ()؛ // 31
للحصول على fav\_srinks من Jack:
- `getFavDrinks());
- // ["coffee","green tea"]
-`
+```php
+getFavDrinks());
+// ["coffee","green tea"]
+```
وتسمى هذه الطريقة في تطبيق واستخدام أساليب الصف لاسترجاع وتحديث خصائص الصفات بالتغليف في البرمجة الشيئية. يمكننا أيضًا تعيين مستوى الرؤية لطرق الصفوف تمامًا مثل الطريقة التي استخدمناها في خصائص الصف.
\ No newline at end of file
diff --git a/guide/arabic/php/php-array/index.md b/guide/arabic/php/php-array/index.md
index 3a674af044..e598e82675 100644
--- a/guide/arabic/php/php-array/index.md
+++ b/guide/arabic/php/php-array/index.md
@@ -53,17 +53,18 @@ localeTitle: صفائف Php
سيؤدي ذلك إلى النتيجة التالية -
- `Value is 1
- Value is 2
- Value is 3
- Value is 4
- Value is 5
- Value is one
- Value is two
- Value is three
- Value is four
- Value is five
-`
+```
+Value is 1
+Value is 2
+Value is 3
+Value is 4
+Value is 5
+Value is one
+Value is two
+Value is three
+Value is four
+Value is five
+```
### صفيفات الارتباط
@@ -101,13 +102,14 @@ localeTitle: صفائف Php
سيؤدي ذلك إلى النتيجة التالية -
- `Salary of mohammad is 2000
- Salary of qadir is 1000
- Salary of zara is 500
- Salary of mohammad is high
- Salary of qadir is medium
- Salary of zara is low
-`
+```
+Salary of mohammad is 2000
+Salary of qadir is 1000
+Salary of zara is 500
+Salary of mohammad is high
+Salary of qadir is medium
+Salary of zara is low
+```
### صفائف متعددة الأبعاد
@@ -158,7 +160,8 @@ localeTitle: صفائف Php
سيؤدي ذلك إلى النتيجة التالية -
- `Marks for mohammad in physics : 35
- Marks for qadir in maths : 32
- Marks for zara in chemistry : 39
-`
\ No newline at end of file
+```
+Marks for mohammad in physics : 35
+Marks for qadir in maths : 32
+Marks for zara in chemistry : 39
+```
\ No newline at end of file
diff --git a/guide/arabic/php/php-cookies/index.md b/guide/arabic/php/php-cookies/index.md
index 4617be3023..d60c2e77d2 100644
--- a/guide/arabic/php/php-cookies/index.md
+++ b/guide/arabic/php/php-cookies/index.md
@@ -28,25 +28,26 @@ localeTitle: الكوكيز بي اتش بي
**مثال:**
- `
-
-
-
- ";
- echo "Value is: " . $_COOKIE[$cookie_name];
- }
- ?>
-
-
-`
+```
+
+
+
+
+";
+ echo "Value is: " . $_COOKIE[$cookie_name];
+}
+?>
+
+
+```
**ملاحظة:** يجب أن تظهر الدالة setcookie () **قبل** العلامة.
@@ -60,26 +61,27 @@ localeTitle: الكوكيز بي اتش بي
**مثال:**
- `
-
-
-
- ";
- echo "Value is: " . $_COOKIE[$cookie_name];
- }
- ?>
-
-
-
-`
+```
+
+
+
+
+";
+ echo "Value is: " . $_COOKIE[$cookie_name];
+}
+?>
+
+
+
+```
انتاج:
تم تعيين Cookie 'user'!
@@ -91,20 +93,21 @@ localeTitle: الكوكيز بي اتش بي
**مثال:**
- `
-
-
-
-
-
-
-
-`
+```
+
+
+
+
+
+
+
+
+```
انتاج:
يتم حذف Cookie 'user'.
\ No newline at end of file
diff --git a/guide/arabic/php/php-data-types/index.md b/guide/arabic/php/php-data-types/index.md
index c7bdb58436..5fd29ea593 100644
--- a/guide/arabic/php/php-data-types/index.md
+++ b/guide/arabic/php/php-data-types/index.md
@@ -21,9 +21,10 @@ localeTitle: أنواع البيانات PHP
#### مثال
- `$x = "Hello!";
- $y = 'Hello!';
-`
+```
+$x = "Hello!";
+$y = 'Hello!';
+```
## PHP Integer
@@ -52,9 +53,10 @@ localeTitle: أنواع البيانات PHP
Boolean يمثل حالتين محتملتين: TRUE أو FALSE. يتم استخدام Booleans غالبًا في الاختبارات الشرطية.
- `$x = true;
- $y = false;
-`
+```
+$x = true;
+$y = false;
+```
## صفيف PHP
@@ -70,11 +72,12 @@ Null هو نوع بيانات خاص يمكن أن يكون له قيمة واح
**ملاحظة:** إذا تم إنشاء متغير بدون قيمة ، فسيتم تعيين قيمة فارغة له تلقائيًا.
- `
-`
+```
+
+```
انتاج:
لا شيء
@@ -87,17 +90,18 @@ Null هو نوع بيانات خاص يمكن أن يكون له قيمة واح
**مثال:**
- `model = "VW";
- }
- }
-
- // create an object
- $herbie = new Car();
-
- // show object properties
- echo $herbie->model;
- ?>
-`
\ No newline at end of file
+```
+model = "VW";
+ }
+}
+
+// create an object
+$herbie = new Car();
+
+// show object properties
+echo $herbie->model;
+?>
+```
\ No newline at end of file
diff --git a/guide/arabic/php/php-echo-print/index.md b/guide/arabic/php/php-echo-print/index.md
index 51b36d0286..7a0b7cca1b 100644
--- a/guide/arabic/php/php-echo-print/index.md
+++ b/guide/arabic/php/php-echo-print/index.md
@@ -22,13 +22,14 @@ localeTitle: PHP 5 صدى وطباعة البيانات
#### مثال
- `PHP is Fun!";
- echo "Hello world! ";
- echo "I'm about to learn PHP! ";
- echo "This ", "string ", "was ", "made ", "with multiple parameters.";
- ?>
-`
+```php
+PHP is Fun!";
+echo "Hello world! ";
+echo "I'm about to learn PHP! ";
+echo "This ", "string ", "was ", "made ", "with multiple parameters.";
+?>
+```
#### عرض المتغيرات
@@ -36,17 +37,18 @@ localeTitle: PHP 5 صدى وطباعة البيانات
#### مثال
- `" . $txt1 . "";
- echo "Study PHP at " . $txt2 . " ";
- echo $x + $y;
- ?>
-`
+```php
+" . $txt1 . "";
+echo "Study PHP at " . $txt2 . " ";
+echo $x + $y;
+?>
+```
### بيان طباعة PHP
@@ -58,12 +60,13 @@ localeTitle: PHP 5 صدى وطباعة البيانات
#### مثال
- `PHP is Fun!";
- print "Hello world! ";
- print "I'm about to learn PHP!";
- ?>
-`
+```php
+PHP is Fun!";
+print "Hello world! ";
+print "I'm about to learn PHP!";
+?>
+```
#### عرض المتغيرات
@@ -71,14 +74,15 @@ localeTitle: PHP 5 صدى وطباعة البيانات
#### مثال
- `" . $txt1 . "";
- print "Study PHP at " . $txt2 . " ";
- print $x + $y;
- ?>
-`
\ No newline at end of file
+```php
+" . $txt1 . "";
+print "Study PHP at " . $txt2 . " ";
+print $x + $y;
+?>
+```
\ No newline at end of file
diff --git a/guide/arabic/php/php-form-handling/index.md b/guide/arabic/php/php-form-handling/index.md
index b4f19b9437..55a2d4652d 100644
--- a/guide/arabic/php/php-form-handling/index.md
+++ b/guide/arabic/php/php-form-handling/index.md
@@ -10,67 +10,72 @@ localeTitle: PHP 5 التعامل مع النموذج
#### مثال
- `
-
-
-
-
-
-
-`
+```php
+
+
+
+
+
+
+
+```
عندما يملأ المستخدم النموذج أعلاه وينقر على زر الإرسال ، يتم إرسال بيانات النموذج للمعالجة إلى ملف PHP المسمى "welcome.php". يتم إرسال بيانات النموذج باستخدام طريقة HTTP POST.
لعرض البيانات المقدمة ، يمكنك ببساطة ترديد كل المتغيرات. يبدو "welcome.php" كما يلي:
- `
-
-
- Welcome
- Your email address is:
-
-
-
-`
+```php
+
+
+
+Welcome
+Your email address is:
+
+
+
+```
يمكن أن يكون الإخراج شيء من هذا القبيل:
- `Welcome John
- Your email address is john.doe@example.com
-`
+```
+Welcome John
+Your email address is john.doe@example.com
+```
يمكن تحقيق نفس النتيجة باستخدام طريقة HTTP GET:
#### مثال
- `
-
-
-
-
-
-
-`
+```php
+
+
+
+
+
+
+
+```
و "welcome\_get.php" يشبه هذا:
- `
-
-
- Welcome
- Your email address is:
-
-
-
-`
+```php
+
+
+
+Welcome
+Your email address is:
+
+
+
+```
الرمز أعلاه بسيط للغاية. ومع ذلك ، فإن الشيء الأكثر أهمية مفقود. يلزمك التحقق من صحة بيانات النموذج لحماية النص البرمجي من الشفرة الضارة.
diff --git a/guide/arabic/php/php-form-required/index.md b/guide/arabic/php/php-form-required/index.md
index 1771a5caa3..c57d935594 100644
--- a/guide/arabic/php/php-form-required/index.md
+++ b/guide/arabic/php/php-form-required/index.md
@@ -14,44 +14,45 @@ localeTitle: نماذج PHP 5 - الحقول المطلوبة
في الشفرة التالية ، أضفنا بعض المتغيرات الجديدة: $ nameErr و $ emailErr و genderErr و $ websiteErr. سوف تحتوي متغيرات الخطأ هذه على رسائل خطأ للحقول المطلوبة. لقد أضفنا أيضًا جملة if else لكل _متغير POST_ $ _. يتحقق هذا إذا كان_ متغير POST _$_ فارغًا (مع وظيفة PHP فارغة ()). إذا كانت فارغة ، يتم تخزين رسالة خطأ في متغيرات الخطأ المختلفة ، وإذا لم تكن فارغة ، فإنها ترسل بيانات إدخال المستخدم من خلال الدالة test\_input ():
- `
-`
+```php
+
+```
### PHP - عرض رسائل الخطأ
@@ -59,29 +60,30 @@ localeTitle: نماذج PHP 5 - الحقول المطلوبة
#### مثال
- `
-`
+```php
+
+```
الخطوة التالية هي التحقق من صحة بيانات الإدخال ، أي "هل يحتوي حقل الاسم على أحرف و مسافة بيضاء فقط؟" ، و "هل يحتوي حقل البريد الإلكتروني على بناء عنوان بريد إلكتروني صالح؟" ، وإذا تم تعبئته ، " هل يحتوي حقل موقع الويب على عنوان URL صالح؟ ".
\ No newline at end of file
diff --git a/guide/arabic/php/php-forms-url-email/index.md b/guide/arabic/php/php-forms-url-email/index.md
index f11c52c7cd..5bb58095db 100644
--- a/guide/arabic/php/php-forms-url-email/index.md
+++ b/guide/arabic/php/php-forms-url-email/index.md
@@ -8,11 +8,12 @@ localeTitle: نماذج PHP 5 - التحقق من البريد الإلكترو
يعرض الرمز أدناه طريقة بسيطة للتحقق مما إذا كان حقل الاسم يحتوي فقط على أحرف ومسافة بيضاء. إذا كانت قيمة حقل الاسم غير صالحة ، فقم بتخزين رسالة خطأ:
- `$name = test_input($_POST["name"]);
- if (!preg_match("/^[a-zA-Z ]*$/",$name)) {
- $nameErr = "Only letters and white space allowed";
- }
-`
+```php
+$name = test_input($_POST["name"]);
+if (!preg_match("/^[a-zA-Z ]*$/",$name)) {
+ $nameErr = "Only letters and white space allowed";
+}
+```
> **تقوم الدالة preg\_match () بالبحث عن سلسلة للنمط ، وإرجاع true إذا كان النمط موجودًا ، والخطأ بخلاف ذلك.**
@@ -22,21 +23,23 @@ localeTitle: نماذج PHP 5 - التحقق من البريد الإلكترو
في الرمز أدناه ، إذا لم يكن عنوان البريد الإلكتروني جيدًا ، فقم بتخزين رسالة خطأ:
- `$email = test_input($_POST["email"]);
- if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
- $emailErr = "Invalid email format";
- }
-`
+```php
+$email = test_input($_POST["email"]);
+if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
+ $emailErr = "Invalid email format";
+}
+```
### PHP - التحقق من صحة URL
يعرض الرمز أدناه طريقة للتحقق مما إذا كان بناء جملة عنوان URL صحيحًا (يسمح هذا التعبير العادي أيضًا بشروط في عنوان URL). إذا كان بناء جملة عنوان URL غير صالح ، فقم بتخزين رسالة خطأ:
- `$website = test_input($_POST["website"]);
- if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$website)) {
- $websiteErr = "Invalid URL";
- }
-`
+```php
+$website = test_input($_POST["website"]);
+if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$website)) {
+ $websiteErr = "Invalid URL";
+}
+```
### PHP - التحقق من صحة الاسم والبريد الإلكتروني وعنوان URL
@@ -44,53 +47,54 @@ localeTitle: نماذج PHP 5 - التحقق من البريد الإلكترو
#### مثال
- `
-`
\ No newline at end of file
+```php
+
+```
\ No newline at end of file
diff --git a/guide/arabic/php/php-functions/index.md b/guide/arabic/php/php-functions/index.md
index 33942030ff..c26f4c732f 100644
--- a/guide/arabic/php/php-functions/index.md
+++ b/guide/arabic/php/php-functions/index.md
@@ -42,8 +42,9 @@ localeTitle: وظائف PHP
سيظهر هذا النتيجة التالية -
- `You are really a nice person, Have a nice time!
-`
+```
+You are really a nice person, Have a nice time!
+```
### وظائف PHP مع المعلمات
@@ -72,8 +73,9 @@ localeTitle: وظائف PHP
سيظهر هذا النتيجة التالية -
- `Sum of the two numbers is : 30
-`
+```
+Sum of the two numbers is : 30
+```
### تمرير الحجج حسب المرجع
@@ -115,9 +117,10 @@ localeTitle: وظائف PHP
سيظهر هذا النتيجة التالية -
- `Original Value is 10
- Original Value is 16
-`
+```
+Original Value is 10
+Original Value is 16
+```
### وظائف PHP العودة القيمة
@@ -151,8 +154,9 @@ localeTitle: وظائف PHP
سيظهر هذا النتيجة التالية -
- `Returned value from the function : 30
-`
+```
+Returned value from the function : 30
+```
### ضبط القيم الافتراضية لمعلمات الدالة
@@ -183,8 +187,9 @@ localeTitle: وظائف PHP
هذا سينتج النتيجة التالية -
- `This is test
-`
+```
+This is test
+```
### المكالمات الديناميكية
@@ -213,5 +218,6 @@ localeTitle: وظائف PHP
سيظهر هذا النتيجة التالية -
- `Hello
-`
\ No newline at end of file
+```
+Hello
+```
\ No newline at end of file
diff --git a/guide/arabic/php/php-install/index.md b/guide/arabic/php/php-install/index.md
index 1f64c8e559..119a00653d 100644
--- a/guide/arabic/php/php-install/index.md
+++ b/guide/arabic/php/php-install/index.md
@@ -14,8 +14,9 @@ localeTitle: تثبيت PHP
اكتب العنوان التالي في مربع عنوان المتصفح الخاص بك.
- `http://127.0.0.1/info.php
-`
+```shell
+http://127.0.0.1/info.php
+```
إذا كان هذا يعرض صفحة تعرض معلومات تثبيت PHP الخاصة بك ، فهذا يعني أنه لديك PHP و Webserver مثبت بشكل صحيح.
diff --git a/guide/arabic/php/php-strings/index.md b/guide/arabic/php/php-strings/index.md
index aa3f28ad56..94481df25f 100644
--- a/guide/arabic/php/php-strings/index.md
+++ b/guide/arabic/php/php-strings/index.md
@@ -25,9 +25,10 @@ $ string _1 = "هذه سلسلة في علامات تنصيص مزدوجة"؛ $
سيؤدي ذلك إلى النتيجة التالية -
- `My $variable will not print!\n
- My name will print
-`
+```
+My $variable will not print!\n
+My name will print
+```
لا توجد حدود صناعية على طول السلسلة - داخل حدود الذاكرة المتوفرة ، يجب أن تكون قادرًا على جعل سلاسل طويلة عشوائية.
@@ -55,8 +56,9 @@ $ string _1 = "هذه سلسلة في علامات تنصيص مزدوجة"؛ $
سيؤدي ذلك إلى النتيجة التالية -
- `Hello World 1234
-`
+```
+Hello World 1234
+```
إذا نظرنا إلى الكود أعلاه سترى أننا استخدمنا عامل التشغيل السلسلتي مرتين. هذا لأنه كان علينا إدخال سلسلة ثالثة.
@@ -68,15 +70,17 @@ $ string _1 = "هذه سلسلة في علامات تنصيص مزدوجة"؛ $
دعونا نعثر على طول السلسلة "Hello world!":
- `
-`
+```
+
+```
سيؤدي ذلك إلى النتيجة التالية -
- `12
-`
+```
+12
+```
غالباً ما يتم استخدام طول سلسلة في حلقات أو دالات أخرى ، عندما يكون من المهم معرفة متى تنتهي السلسلة. (أي في حلقة ، نود إيقاف الحلقة بعد الحرف الأخير في السلسلة)
@@ -88,10 +92,11 @@ $ string _1 = "هذه سلسلة في علامات تنصيص مزدوجة"؛ $
دعونا نرى ما إذا كان بإمكاننا العثور على سلسلة "العالم" في سلسلتنا -
- `
-`
+```
+
+```
سيؤدي ذلك إلى النتيجة التالية -
diff --git a/guide/arabic/php/php-switch/index.md b/guide/arabic/php/php-switch/index.md
index 5cc6418623..e66cb0ad88 100644
--- a/guide/arabic/php/php-switch/index.md
+++ b/guide/arabic/php/php-switch/index.md
@@ -27,39 +27,41 @@ localeTitle: تبديل PHP
شكل توضيحي لبيان `switch` مع مثال
- `
-`
+```
+
+```
يمكن أيضًا استخدام عبارة `switch` دون بيان `break` . في هذه الحالة ، سيتم تنفيذ العبارات بعد الحالات المتطابقة. أدناه هو استخدام بيان `switch` دون بيان `break` .
- `
-
- /*output --> i equals 0i equals 1i equals 2 */
-`
+```
+
+
+/*output --> i equals 0i equals 1i equals 2 */
+```
#### معلومات اكثر:
diff --git a/guide/arabic/php/php-syntax/index.md b/guide/arabic/php/php-syntax/index.md
index 0b752ed176..89272d38b0 100644
--- a/guide/arabic/php/php-syntax/index.md
+++ b/guide/arabic/php/php-syntax/index.md
@@ -16,19 +16,20 @@ localeTitle: بناء php
#### عينة التعليمات البرمجية
- `
-
-
-
-
My first PHP page
-
-
-
-
-
-`
+```
+
+
+
+
+
My first PHP page
+
+
+
+
+
+```
##### ملاحظة: تنتهي عبارات PHP بفاصلة منقوطة `;`
@@ -36,46 +37,50 @@ localeTitle: بناء php
نعلن عن وجود متغيرات في PHP عن طريق إضافة علامة `$` قبلها.
- `
-`
+```
+
+```
### تعليقات في PHP
لكتابة تعليق سطر واحد في PHP ، نضع hashtag `#` أو بوضع `//` قبل التعليق.
- `
-`
+```
+
+```
لكتابة تعليق خط مزدوج ، نبدأ التعليق مع `/*` وننتهي بـ `*/` .
- `
-`
+```
+
+```
يمكننا أيضًا التعليق على بعض أجزاء سطر الشفرة.
#### عينة الكود
- `
-
-
-
-
-
-
-
-`
+```
+
+
+
+
+
+
+
+
+```
يمكنك معرفة المزيد عن هذا في [دليل PHP](http://php.net/manual/en/)
\ No newline at end of file
diff --git a/guide/arabic/php/php-tags/index.md b/guide/arabic/php/php-tags/index.md
index 8d8039fc06..0a0e637b0b 100644
--- a/guide/arabic/php/php-tags/index.md
+++ b/guide/arabic/php/php-tags/index.md
@@ -8,12 +8,13 @@ PHP يسمح أيضا لعلامة مفتوحة قصيرة `` (وهو أمر
إذا كان الملف عبارة عن كود PHP خالص ، فمن الأفضل حذف علامة إغلاق PHP في نهاية الملف. يؤدي ذلك إلى منع المساحات البيضاء أو الخطوط الجديدة التي تتم إضافتها بعد علامة إغلاق PHP ، والتي قد تتسبب في حدوث تأثيرات غير مرغوب فيها لأن PHP سيبدأ التخزين المؤقت للإخراج عندما لا يكون هناك نية من المبرمج لإرسال أي إخراج عند هذه النقطة في البرنامج النصي.
- `
-`
+```php
+
+```
بعد تنفيذ البيانات أعلاه، المتغير `$myVariable` سيعقد سلسلة مع قيمة أهلا بالعالم! المتغير `$x` سيعقدون صحيح بقيمة 5 و المتغير `$y` سيعقد تعويم بقيمة من 10.5 ، وسيحتوي المتغير `$z` على سلسلة بقيمة 42.
diff --git a/guide/arabic/php/polymorphism-abstract-interface/index.md b/guide/arabic/php/polymorphism-abstract-interface/index.md
index e49d210537..713c61a732 100644
--- a/guide/arabic/php/polymorphism-abstract-interface/index.md
+++ b/guide/arabic/php/polymorphism-abstract-interface/index.md
@@ -48,12 +48,13 @@ _مشاركة وفرض الكود مع تعدد الأشكال باستخدام
نحتاج إلى تحديد الاسم والعمر والطول لتكوين هذه الفئة وفقًا لما يتطلبه المنشئ.
- `name, $jack->age, $jack->height);
- // => Jack - 26 - 5 Feet 6 Inches
-`
+```php
+name, $jack->age, $jack->height);
+// => Jack - 26 - 5 Feet 6 Inches
+```
الآن ، دعنا نقول أننا نريد إضافة طريقة جديدة لهذه الفئة تسمى isActive.
@@ -99,21 +100,22 @@ _مشاركة وفرض الكود مع تعدد الأشكال باستخدام
يمكننا الحصول على if..sese..else مثل هذه العبارات:
- `active == 1) {
- return "I am an idle man.";
- } elseif ($this->active == 2) {
- return "I am a lightly active man.";
- } elseif ($this->active == 3) {
- return "I am a moderately active man.";
- } else {
- return "I am a very active man.";
- }
- }
-`
+```php
+active == 1) {
+ return "I am an idle man.";
+ } elseif ($this->active == 2) {
+ return "I am a lightly active man.";
+ } elseif ($this->active == 3) {
+ return "I am a moderately active man.";
+ } else {
+ return "I am a very active man.";
+ }
+}
+```
الآن ، لنأخذ هذه خطوة أخرى.
@@ -133,55 +135,60 @@ _مشاركة وفرض الكود مع تعدد الأشكال باستخدام
# 1: تعريف الصف كملخص.
- `isActive();
- // => I am a very active athlete.
-`
+```php
+isActive();
+// => I am a very active athlete.
+```
كامل تعريف فئة الملخص ورمز التنفيذ:
@@ -237,11 +244,12 @@ _مشاركة وفرض الكود مع تعدد الأشكال باستخدام
الآن لا يمكن إنشاء مثيل لطبقة `Man` مباشرة لإنشاء كائن.
- `isActive();
- // => Fatal error: Uncaught Error: Cannot instantiate abstract class Man
-`
+```php
+isActive();
+// => Fatal error: Uncaught Error: Cannot instantiate abstract class Man
+```
أيضا ، كل فئة طفل من الطبقة المجردة (درجة `Man` ) تحتاج إلى تنفيذ جميع الأساليب المجردة. سوف يؤدي عدم تنفيذ مثل هذا إلى خطأ فادح.
@@ -325,11 +333,12 @@ _مشاركة وفرض الكود مع تعدد الأشكال باستخدام
# 3: تحفيز فئة التنفيذ (AthleticMan)
- `isActive();
- // => I am a very active athlete.
-`
+```php
+isActive();
+// => I am a very active athlete.
+```
باستخدام الواجهات ، يجب أن تضع في اعتبارك ما يلي:
diff --git a/guide/arabic/php/pp-sessions/index.md b/guide/arabic/php/pp-sessions/index.md
index e746647b2e..339259003e 100644
--- a/guide/arabic/php/pp-sessions/index.md
+++ b/guide/arabic/php/pp-sessions/index.md
@@ -27,24 +27,25 @@ localeTitle: جلسات PHP
**مثال:**
- `
-
-
-
-
-
-
-
-
-`
+```
+
+
+
+
+
+
+
+
+
+```
**ملاحظة:** يجب أن تكون الدالة session\_start () **أول شيء** في المستند. **قبل** أي علامات HTML.
@@ -59,22 +60,23 @@ localeTitle: جلسات PHP
**مثال:**
- `
-
-
-
-
- ";
- echo "Favorite animal is " . $_SESSION["favanimal"] . ".";
- ?>
-
-
-
-`
+```
+
+
+
+
+
+";
+echo "Favorite animal is " . $_SESSION["favanimal"] . ".";
+?>
+
+
+
+```
انتاج:
اللون المفضل باللون الأزرق.
@@ -82,10 +84,11 @@ localeTitle: جلسات PHP
هناك طريقة أخرى لإظهار كافة قيم متغير جلسة العمل لجلسة مستخدم هي تشغيل التعليمة البرمجية التالية:
- `
-`
+```
+
+```
### كيف يعمل؟
@@ -99,22 +102,23 @@ localeTitle: جلسات PHP
**مثال:**
- `
-
-
-
-
-
-
-
-
-`
+```
+
+
+
+
+
+
+
+
+
+```
## تدمير دورة PHP
@@ -122,21 +126,22 @@ localeTitle: جلسات PHP
**مثال:**
- `
-
-
-
-
-
-
-
-
-`
\ No newline at end of file
+```
+
+
+
+
+
+
+
+
+
+```
\ No newline at end of file
diff --git a/guide/arabic/php/security/cross-site-request-forgery/index.md b/guide/arabic/php/security/cross-site-request-forgery/index.md
index 237b5da376..8575b3da02 100644
--- a/guide/arabic/php/security/cross-site-request-forgery/index.md
+++ b/guide/arabic/php/security/cross-site-request-forgery/index.md
@@ -14,15 +14,16 @@ Cross Site Request Forgery هي نقطة ضعف في التطبيق بسبب ع
للدفاع ضد هجوم موقع التزوير طلب التزوير ، يجب عليك التحقق من رمز مميز تم تغييره بشكل منتظم. `/admin/deletecomment.php?id=123` عنوان url `/admin/deletecomment.php?id=123` إلى `/admin/deletecomment.php?id=123&csrf-token=random-per-user-unique-string-here` .
- `Delete Comment'; // Only the logged in user has access to the CSRF Token - the token isn't accessible to the attacker preventing their attack from being successful.
-`
+```PHP
+Delete Comment'; // Only the logged in user has access to the CSRF Token - the token isn't accessible to the attacker preventing their attack from being successful.
+```
#### معلومات اكثر:
diff --git a/guide/arabic/php/security/cross-site-scripting/index.md b/guide/arabic/php/security/cross-site-scripting/index.md
index 71bb78c8a1..bb453fbf2a 100644
--- a/guide/arabic/php/security/cross-site-scripting/index.md
+++ b/guide/arabic/php/security/cross-site-scripting/index.md
@@ -10,10 +10,11 @@ Cross Site Scripting هو نوع من نقاط الضعف في تطبيق الو
تسمح المدونة للمستخدمين بوضع تعليقاتهم باستخدام علامات HTML ، إلا أن النص البرمجي الذي يمد المدونة لا يزيل علامات `
-`
+```HTML
+
+```
### الدفاع عن موقع الويب الخاص بك من هجمات البرمجة عبر الموقع في PHP
@@ -21,28 +22,31 @@ Cross Site Scripting هو نوع من نقاط الضعف في تطبيق الو
`htmlspecialchars($string)` وظيفة `htmlspecialchars($string)` منع سلسلة HTML من العرض كملف HTML وعرضها كنص عادي لمتصفح الويب. **htmlspecialchars () مثال التعليمات البرمجية**
- `alert('Cross Site Scripting!');";
- echo htmlspecialchars($usercomment);
-`
+```PHP
+alert('Cross Site Scripting!');";
+echo htmlspecialchars($usercomment);
+```
الطريقة الأخرى هي `strip_tags($string, $allowedtags)` التي تزيل كل علامات HTML باستثناء علامات HTML التي قمت بإضافتها إلى القائمة البيضاء. من المهم أن نلاحظ أنه مع وظيفة `strip_tags()` يجب أن تكون أكثر حذراً ، هذه الوظيفة لا تمنع المستخدم من تضمين javascript كحلقة ارتباط ، سيكون عليك تطهير ذلك بمفردنا.
**code\_tags () مثال التعليمات البرمجية**
- `alert('Cross Site Scripting!');";
- $allowedtags = "