lines-num lines-num-new"> 13
+        "build": {
14
+          "builder": "@angular-devkit/build-angular:browser",
15
+          "options": {
16
+            "outputPath": "www",
17
+            "index": "src/index.html",
18
+            "main": "src/main.ts",
19
+            "polyfills": "src/polyfills.ts",
20
+            "tsConfig": "tsconfig.app.json",
21
+            "assets": [
22
+              {
23
+                "glob": "**/*",
24
+                "input": "src/assets",
25
+                "output": "assets"
26
+              },
27
+              {
28
+                "glob": "**/*.svg",
29
+                "input": "node_modules/ionicons/dist/ionicons/svg",
30
+                "output": "./svg"
31
+              }
32
+            ],
33
+            "styles": ["src/theme/variables.scss", "src/global.scss"],
34
+            "scripts": [],
35
+            "aot": false,
36
+            "vendorChunk": true,
37
+            "extractLicenses": false,
38
+            "buildOptimizer": false,
39
+            "sourceMap": true,
40
+            "optimization": false,
41
+            "namedChunks": true
42
+          },
43
+          "configurations": {
44
+            "production": {
45
+              "fileReplacements": [
46
+                {
47
+                  "replace": "src/environments/environment.ts",
48
+                  "with": "src/environments/environment.prod.ts"
49
+                }
50
+              ],
51
+              "optimization": true,
52
+              "outputHashing": "all",
53
+              "sourceMap": false,
54
+              "namedChunks": false,
55
+              "aot": true,
56
+              "extractLicenses": true,
57
+              "vendorChunk": false,
58
+              "buildOptimizer": true,
59
+              "budgets": [
60
+                {
61
+                  "type": "initial",
62
+                  "maximumWarning": "2mb",
63
+                  "maximumError": "5mb"
64
+                }
65
+              ]
66
+            },
67
+            "ci": {
68
+              "progress": false
69
+            }
70
+          }
71
+        },
72
+        "serve": {
73
+          "builder": "@angular-devkit/build-angular:dev-server",
74
+          "options": {
75
+            "browserTarget": "app:build"
76
+          },
77
+          "configurations": {
78
+            "production": {
79
+              "browserTarget": "app:build:production"
80
+            },
81
+            "ci": {
82
+              "progress": false
83
+            }
84
+          }
85
+        },
86
+        "extract-i18n": {
87
+          "builder": "@angular-devkit/build-angular:extract-i18n",
88
+          "options": {
89
+            "browserTarget": "app:build"
90
+          }
91
+        },
92
+        "test": {
93
+          "builder": "@angular-devkit/build-angular:karma",
94
+          "options": {
95
+            "main": "src/test.ts",
96
+            "polyfills": "src/polyfills.ts",
97
+            "tsConfig": "tsconfig.spec.json",
98
+            "karmaConfig": "karma.conf.js",
99
+            "styles": [],
100
+            "scripts": [],
101
+            "assets": [
102
+              {
103
+                "glob": "favicon.ico",
104
+                "input": "src/",
105
+                "output": "/"
106
+              },
107
+              {
108
+                "glob": "**/*",
109
+                "input": "src/assets",
110
+                "output": "/assets"
111
+              }
112
+            ]
113
+          },
114
+          "configurations": {
115
+            "ci": {
116
+              "progress": false,
117
+              "watch": false
118
+            }
119
+          }
120
+        },
121
+        "lint": {
122
+          "builder": "@angular-eslint/builder:lint",
123
+          "options": {
124
+            "lintFilePatterns": [
125
+              "src/**/*.ts",
126
+              "src/**/*.html"
127
+            ]
128
+          }
129
+        },
130
+        "e2e": {
131
+          "builder": "@angular-devkit/build-angular:protractor",
132
+          "options": {
133
+            "protractorConfig": "e2e/protractor.conf.js",
134
+            "devServerTarget": "app:serve"
135
+          },
136
+          "configurations": {
137
+            "production": {
138
+              "devServerTarget": "app:serve:production"
139
+            },
140
+            "ci": {
141
+              "devServerTarget": "app:serve:ci"
142
+            }
143
+          }
144
+        }
145
+      }
146
+    }
147
+  },
148
+  "cli": {
149
+    "schematicCollections": [
150
+      "@ionic/angular-toolkit"
151
+    ],
152
+    "analytics": false
153
+  },
154
+  "schematics": {
155
+    "@ionic/angular-toolkit:component": {
156
+      "styleext": "scss"
157
+    },
158
+    "@ionic/angular-toolkit:page": {
159
+      "styleext": "scss"
160
+    }
161
+  }
162
+}

+ 10 - 0
capacitor.config.ts

@@ -0,0 +1,10 @@
1
+import { CapacitorConfig } from '@capacitor/cli';
2
+
3
+const config: CapacitorConfig = {
4
+  appId: 'io.ionic.starter',
5
+  appName: 'ra100',
6
+  webDir: 'www',
7
+  bundledWebRuntime: false
8
+};
9
+
10
+export default config;

+ 37 - 0
e2e/protractor.conf.js

@@ -0,0 +1,37 @@
1
+// @ts-check
2
+// Protractor configuration file, see link for more information
3
+// https://github.com/angular/protractor/blob/master/lib/config.ts
4
+
5
+const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter');
6
+
7
+/**
8
+ * @type { import("protractor").Config }
9
+ */
10
+exports.config = {
11
+  allScriptsTimeout: 11000,
12
+  specs: [
13
+    './src/**/*.e2e-spec.ts'
14
+  ],
15
+  capabilities: {
16
+    browserName: 'chrome'
17
+  },
18
+  directConnect: true,
19
+  SELENIUM_PROMISE_MANAGER: false,
20
+  baseUrl: 'http://localhost:4200/',
21
+  framework: 'jasmine',
22
+  jasmineNodeOpts: {
23
+    showColors: true,
24
+    defaultTimeoutInterval: 30000,
25
+    print: function() {}
26
+  },
27
+  onPrepare() {
28
+    require('ts-node').register({
29
+      project: require('path').join(__dirname, './tsconfig.json')
30
+    });
31
+    jasmine.getEnv().addReporter(new SpecReporter({
32
+      spec: {
33
+        displayStacktrace: StacktraceOption.PRETTY
34
+      }
35
+    }));
36
+  }
37
+};

+ 14 - 0
e2e/src/app.e2e-spec.ts

@@ -0,0 +1,14 @@
1
+import { AppPage } from './app.po';
2
+
3
+describe('new App', () => {
4
+  let page: AppPage;
5
+
6
+  beforeEach(() => {
7
+    page = new AppPage();
8
+  });
9
+
10
+  it('should be blank', () => {
11
+    page.navigateTo();
12
+    expect(page.getParagraphText()).toContain('Start with Ionic UI Components');
13
+  });
14
+});

+ 11 - 0
e2e/src/app.po.ts

@@ -0,0 +1,11 @@
1
+import { browser, by, element } from 'protractor';
2
+
3
+export class AppPage {
4
+  navigateTo() {
5
+    return browser.get('/');
6
+  }
7
+
8
+  getParagraphText() {
9
+    return element(by.deepCss('app-root ion-content')).getText();
10
+  }
11
+}

+ 12 - 0
e2e/tsconfig.json

@@ -0,0 +1,12 @@
1
+{
2
+  "extends": "../tsconfig.json",
3
+  "compilerOptions": {
4
+    "outDir": "../out-tsc/e2e",
5
+    "module": "commonjs",
6
+    "target": "es2018",
7
+    "types": [
8
+      "jasmine",
9
+      "node"
10
+    ]
11
+  }
12
+}

+ 7 - 0
ionic.config.json

@@ -0,0 +1,7 @@
1
+{
2
+  "name": "ra100",
3
+  "integrations": {
4
+    "capacitor": {}
5
+  },
6
+  "type": "angular"
7
+}

+ 44 - 0
karma.conf.js

@@ -0,0 +1,44 @@
1
+// Karma configuration file, see link for more information
2
+// https://karma-runner.github.io/1.0/config/configuration-file.html
3
+
4
+module.exports = function (config) {
5
+  config.set({
6
+    basePath: '',
7
+    frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
+    plugins: [
9
+      require('karma-jasmine'),
10
+      require('karma-chrome-launcher'),
11
+      require('karma-jasmine-html-reporter'),
12
+      require('karma-coverage'),
13
+      require('@angular-devkit/build-angular/plugins/karma')
14
+    ],
15
+    client: {
16
+      jasmine: {
17
+        // you can add configuration options for Jasmine here
18
+        // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19
+        // for example, you can disable the random execution with `random: false`
20
+        // or set a specific seed with `seed: 4321`
21
+      },
22
+      clearContext: false // leave Jasmine Spec Runner output visible in browser
23
+    },
24
+    jasmineHtmlReporter: {
25
+      suppressAll: true // removes the duplicated traces
26
+    },
27
+    coverageReporter: {
28
+      dir: require('path').join(__dirname, './coverage/ngv'),
29
+      subdir: '.',
30
+      reporters: [
31
+        { type: 'html' },
32
+        { type: 'text-summary' }
33
+      ]
34
+    },
35
+    reporters: ['progress', 'kjhtml'],
36
+    port: 9876,
37
+    colors: true,
38
+    logLevel: config.LOG_INFO,
39
+    autoWatch: true,
40
+    browsers: ['Chrome'],
41
+    singleRun: false,
42
+    restartOnFileChange: true
43
+  });
44
+};

文件差异内容过多而无法显示
+ 29245 - 0
package-lock.json


+ 73 - 0
package.json

@@ -0,0 +1,73 @@
1
+{
2
+  "name": "ra100",
3
+  "version": "0.0.1",
4
+  "author": "Ionic Framework",
5
+  "homepage": "https://ionicframework.com/",
6
+  "scripts": {
7
+    "ng": "ng",
8
+    "start": "ng serve",
9
+    "build": "ng build",
10
+    "test": "ng test",
11
+    "lint": "ng lint",
12
+    "e2e": "ng e2e"
13
+  },
14
+  "private": true,
15
+  "dependencies": {
16
+    "@angular/common": "^14.0.0",
17
+    "@angular/core": "^14.0.0",
18
+    "@angular/forms": "^14.0.0",
19
+    "@angular/platform-browser": "^14.0.0",
20
+    "@angular/platform-browser-dynamic": "^14.0.0",
21
+    "@angular/router": "^14.0.0",
22
+    "@capacitor/app": "4.1.0",
23
+    "@capacitor/core": "4.4.0",
24
+    "@capacitor/haptics": "4.0.1",
25
+    "@capacitor/keyboard": "4.0.1",
26
+    "@capacitor/status-bar": "4.0.1",
27
+    "@fortawesome/angular-fontawesome": "^0.11.1",
28
+    "@fortawesome/fontawesome-svg-core": "^6.2.0",
29
+    "@fortawesome/free-brands-svg-icons": "^6.2.0",
30
+    "@fortawesome/free-regular-svg-icons": "^6.2.0",
31
+    "@fortawesome/free-solid-svg-icons": "^6.2.0",
32
+    "@ionic/angular": "^6.1.9",
33
+    "ionicons": "^6.0.3",
34
+    "rxjs": "~6.6.0",
35
+    "swiper": "^8.4.4",
36
+    "tslib": "^2.2.0",
37
+    "zone.js": "~0.11.4"
38
+  },
39
+  "devDependencies": {
40
+    "@angular-devkit/build-angular": "^14.0.0",
41
+    "@angular-eslint/builder": "~13.0.1",
42
+    "@angular-eslint/eslint-plugin": "~13.0.1",
43
+    "@angular-eslint/eslint-plugin-template": "~13.0.1",
44
+    "@angular-eslint/template-parser": "~13.0.1",
45
+    "@angular/cli": "^14.0.0",
46
+    "@angular/compiler": "^14.0.0",
47
+    "@angular/compiler-cli": "^14.0.0",
48
+    "@angular/language-service": "^14.0.0",
49
+    "@capacitor/cli": "4.4.0",
50
+    "@ionic/angular-toolkit": "^6.0.0",
51
+    "@types/jasmine": "~3.6.0",
52
+    "@types/jasminewd2": "~2.0.3",
53
+    "@types/node": "^12.11.1",
54
+    "@typescript-eslint/eslint-plugin": "5.3.0",
55
+    "@typescript-eslint/parser": "5.3.0",
56
+    "eslint": "^7.6.0",
57
+    "eslint-plugin-import": "2.22.1",
58
+    "eslint-plugin-jsdoc": "30.7.6",
59
+    "eslint-plugin-prefer-arrow": "1.2.2",
60
+    "jasmine-core": "~3.8.0",
61
+    "jasmine-spec-reporter": "~5.0.0",
62
+    "karma": "~6.3.2",
63
+    "karma-chrome-launcher": "~3.1.0",
64
+    "karma-coverage": "~2.0.3",
65
+    "karma-coverage-istanbul-reporter": "~3.0.2",
66
+    "karma-jasmine": "~4.0.0",
67
+    "karma-jasmine-html-reporter": "^1.5.0",
68
+    "protractor": "~7.0.0",
69
+    "ts-node": "~8.3.0",
70
+    "typescript": "~4.7.3"
71
+  },
72
+  "description": "An Ionic project"
73
+}

+ 42 - 0
src/app/app-routing.module.ts

@@ -0,0 +1,42 @@
1
+import { NgModule } from '@angular/core';
2
+import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
3
+
4
+const routes: Routes = [
5
+  // {
6
+  //   path: 'home',
7
+  //   loadChildren: () => import('./home/home.module').then( m => m.HomePageModule)
8
+  // },
9
+  // {
10
+  //   path: 'navtabs',
11
+  //   loadChildren: () => import('./navtabs/navtabs.module').then( m => m.NavtabsPageModule)
12
+  // },
13
+  {
14
+    path: '',
15
+    redirectTo: 'navtabs',
16
+    pathMatch: 'full'
17
+  },
18
+  {
19
+    path: 'navtabs',
20
+    loadChildren: () => import('./navtabs/navtabs.module').then( m => m.NavtabsPageModule)
21
+  },
22
+  // {
23
+  //   path: 'youtube',
24
+  //   loadChildren: () => import('./youtube/youtube.module').then( m => m.YoutubePageModule)
25
+  // },
26
+  // {
27
+  //   path: 'article',
28
+  //   loadChildren: () => import('./article/article.module').then( m => m.ArticlePageModule)
29
+  // },
30
+  // {
31
+  //   path: 'navtabs',
32
+  //   loadChildren: () => import('./navtabs/navtabs.module').then( m => m.NavtabsPageModule)
33
+  // },
34
+];
35
+
36
+@NgModule({
37
+  imports: [
38
+    RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
39
+  ],
40
+  exports: [RouterModule]
41
+})
42
+export class AppRoutingModule { }

+ 25 - 0
src/app/app.component.html

@@ -0,0 +1,25 @@
1
+<ion-app>
2
+  <ion-menu side="start" contentId="content">
3
+    <ion-header>
4
+      <ion-toolbar>
5
+        <ion-title class="menu-title">Menu</ion-title>
6
+      </ion-toolbar>
7
+    </ion-header>
8
+    <ion-content>
9
+      <ion-list>
10
+        <ion-menu-toggle auto-hide="true">
11
+          <ion-item routerLink="/tabs/tab1" routerDirection="forward">
12
+            <ion-label>Tab 1</ion-label>
13
+          </ion-item>
14
+          <ion-item routerLink="/tabs/tab2" routerDirection="forward">
15
+            <ion-label>Tab 2</ion-label>
16
+          </ion-item>
17
+          <ion-item routerLink="/tabs/tab3" routerDirection="forward">
18
+            <ion-label>Tab 3</ion-label>
19
+          </ion-item>
20
+        </ion-menu-toggle>
21
+      </ion-list>
22
+    </ion-content>
23
+  </ion-menu>
24
+  <ion-router-outlet id="content"></ion-router-outlet>
25
+</ion-app>  

+ 0 - 0
src/app/app.component.scss


+ 23 - 0
src/app/app.component.spec.ts

@@ -0,0 +1,23 @@
1
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
+import { TestBed, waitForAsync } from '@angular/core/testing';
3
+
4
+import { AppComponent } from './app.component';
5
+
6
+describe('AppComponent', () => {
7
+
8
+  beforeEach(waitForAsync(() => {
9
+
10
+    TestBed.configureTestingModule({
11
+      declarations: [AppComponent],
12
+      schemas: [CUSTOM_ELEMENTS_SCHEMA],
13
+    }).compileComponents();
14
+  }));
15
+
16
+  it('should create the app', () => {
17
+    const fixture = TestBed.createComponent(AppComponent);
18
+    const app = fixture.debugElement.componentInstance;
19
+    expect(app).toBeTruthy();
20
+  });
21
+  // TODO: add more tests!
22
+
23
+});

+ 10 - 0
src/app/app.component.ts

@@ -0,0 +1,10 @@
1
+import { Component } from '@angular/core';
2
+
3
+@Component({
4
+  selector: 'app-root',
5
+  templateUrl: 'app.component.html',
6
+  styleUrls: ['app.component.scss'],
7
+})
8
+export class AppComponent {
9
+  constructor() {}
10
+}

+ 26 - 0
src/app/app.module.ts

@@ -0,0 +1,26 @@
1
+import { NgModule } from '@angular/core';
2
+import { BrowserModule } from '@angular/platform-browser';
3
+import { RouteReuseStrategy } from '@angular/router';
4
+
5
+import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
6
+
7
+import { AppComponent } from './app.component';
8
+import { AppRoutingModule } from './app-routing.module';
9
+import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
10
+import { fas } from '@fortawesome/free-solid-svg-icons'
11
+import { far } from '@fortawesome/free-regular-svg-icons'
12
+import { fab } from '@fortawesome/free-brands-svg-icons'
13
+
14
+@NgModule({
15
+  declarations: [AppComponent],
16
+  imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, FontAwesomeModule],
17
+  providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
18
+  bootstrap: [AppComponent],
19
+})
20
+export class AppModule {
21
+
22
+  constructor(library: FaIconLibrary) { 
23
+		library.addIconPacks(fas, far, fab);
24
+	}
25
+  
26
+}

+ 17 - 0
src/app/article/article-routing.module.ts

@@ -0,0 +1,17 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+
4
+import { ArticlePage } from './article.page';
5
+
6
+const routes: Routes = [
7
+  {
8
+    path: '',
9
+    component: ArticlePage
10
+  }
11
+];
12
+
13
+@NgModule({
14
+  imports: [RouterModule.forChild(routes)],
15
+  exports: [RouterModule],
16
+})
17
+export class ArticlePageRoutingModule {}

+ 20 - 0
src/app/article/article.module.ts

@@ -0,0 +1,20 @@
1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+import { FormsModule } from '@angular/forms';
4
+
5
+import { IonicModule } from '@ionic/angular';
6
+
7
+import { ArticlePageRoutingModule } from './article-routing.module';
8
+
9
+import { ArticlePage } from './article.page';
10
+
11
+@NgModule({
12
+  imports: [
13
+    CommonModule,
14
+    FormsModule,
15
+    IonicModule,
16
+    ArticlePageRoutingModule
17
+  ],
18
+  declarations: [ArticlePage]
19
+})
20
+export class ArticlePageModule {}

+ 9 - 0
src/app/article/article.page.html

@@ -0,0 +1,9 @@
1
+<ion-header>
2
+  <ion-toolbar>
3
+    <ion-title>article</ion-title>
4
+  </ion-toolbar>
5
+</ion-header>
6
+
7
+<ion-content>
8
+
9
+</ion-content>

+ 0 - 0
src/app/article/article.page.scss


+ 24 - 0
src/app/article/article.page.spec.ts

@@ -0,0 +1,24 @@
1
+import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
+import { IonicModule } from '@ionic/angular';
3
+
4
+import { ArticlePage } from './article.page';
5
+
6
+describe('ArticlePage', () => {
7
+  let component: ArticlePage;
8
+  let fixture: ComponentFixture<ArticlePage>;
9
+
10
+  beforeEach(waitForAsync(() => {
11
+    TestBed.configureTestingModule({
12
+      declarations: [ ArticlePage ],
13
+      imports: [IonicModule.forRoot()]
14
+    }).compileComponents();
15
+
16
+    fixture = TestBed.createComponent(ArticlePage);
17
+    component = fixture.componentInstance;
18
+    fixture.detectChanges();
19
+  }));
20
+
21
+  it('should create', () => {
22
+    expect(component).toBeTruthy();
23
+  });
24
+});

+ 15 - 0
src/app/article/article.page.ts

@@ -0,0 +1,15 @@
1
+import { Component, OnInit } from '@angular/core';
2
+
3
+@Component({
4
+  selector: 'app-article',
5
+  templateUrl: './article.page.html',
6
+  styleUrls: ['./article.page.scss'],
7
+})
8
+export class ArticlePage implements OnInit {
9
+
10
+  constructor() { }
11
+
12
+  ngOnInit() {
13
+  }
14
+
15
+}

+ 16 - 0
src/app/home/home-routing.module.ts

@@ -0,0 +1,16 @@
1
+import { NgModule } from '@angular/core';
2
+import { RouterModule, Routes } from '@angular/router';
3
+import { HomePage } from './home.page';
4
+
5
+const routes: Routes = [
6
+  {
7
+    path: '',
8
+    component: HomePage,
9
+  }
10
+];
11
+
12
+@NgModule({
13
+  imports: [RouterModule.forChild(routes)],
14
+  exports: [RouterModule]
15
+})
16
+export class HomePageRoutingModule {}

+ 22 - 0
src/app/home/home.module.ts

@@ -0,0 +1,22 @@
1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+import { IonicModule } from '@ionic/angular';
4
+import { FormsModule } from '@angular/forms';
5
+import { HomePage } from './home.page';
6
+
7
+import { HomePageRoutingModule } from './home-routing.module';
8
+import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
9
+import { SwiperModule } from 'swiper/angular';
10
+
11
+@NgModule({
12
+  imports: [
13
+    CommonModule,
14
+    FormsModule,
15
+    IonicModule,
16
+    HomePageRoutingModule,
17
+    FontAwesomeModule,
18
+    SwiperModule
19
+  ],
20
+  declarations: [HomePage]
21
+})
22
+export class HomePageModule {}

+ 86 - 0
src/app/home/home.page.html

@@ -0,0 +1,86 @@
1
+<ion-header [translucent]="true">
2
+  <ion-toolbar>
3
+    <ion-buttons slot="end">
4
+      <ion-menu-button></ion-menu-button>
5
+    </ion-buttons>
6
+    <img src="../../../assets/icon/logo-fm99.png" class="head-img">
7
+  </ion-toolbar>
8
+</ion-header>
9
+<ion-content>
10
+  <swiper #swiper [config]="config">
11
+    <ng-template swiperSlide><img src="../../../assets/img-static/fb-Ad-1.jpeg" alt=""></ng-template>
12
+    <ng-template swiperSlide><img src="../../../assets/img-static/fb-Ad-2.jpeg" alt=""></ng-template>
13
+    <ng-template swiperSlide><img src="../../../assets/img-static/fb-Ad-3.jpeg" alt=""></ng-template>
14
+  </swiper>
15
+  <!-- <div id="container">
16
+    <fa-icon [icon]="['fas', 'graduation-cap']"></fa-icon>
17
+    <hr>
18
+    <strong>Ready to create an app?</strong>
19
+    <p>Start with Ionic <a target="_blank" rel="noopener noreferrer"
20
+        href="https://ionicframework.com/docs/components">UI Components</a></p>
21
+  </div> -->
22
+  <ion-grid>
23
+    <ion-row>
24
+      <ion-col>
25
+        <h2>ข่าวกีฬา</h2>
26
+      </ion-col>
27
+    </ion-row>
28
+    <ion-row>
29
+      <ion-col size="5">
30
+        <img src="../../assets/img-static/SEI129887404-c4a9.jpg">
31
+      </ion-col>
32
+      <ion-col>“น้องเทนนิส” หวังคว้าแชมป์ในศึกชิงแชมป์โลก ต้นเดือนหน้า</ion-col>
33
+    </ion-row>
34
+    <ion-row>
35
+      <ion-col size="5">
36
+        <img src="../../assets/img-static/SEI129887404-c4a9.jpg">
37
+      </ion-col>
38
+      <ion-col>โรนัลโด กลับมาซ้อมกับทีม พร้อมปรับความเข้าใจกับ เทน ฮาก</ion-col>
39
+    </ion-row>
40
+    <ion-row>
41
+      <ion-col size="5">
42
+        <img src="../../assets/img-static/SEI129887404-c4a9.jpg">
43
+      </ion-col>
44
+      <ion-col>เตรียมหารือบอร์ดหาข้อสรุป รัฐ-เอกชน จับมือยิงสดฟุตบอลโลก</ion-col>
45
+    </ion-row>
46
+    <ion-row>
47
+      <ion-col size="5">
48
+        <img src="../../assets/img-static/SEI129887404-c4a9.jpg">
49
+      </ion-col>
50
+      <ion-col>บีจี แยกทางกับ “มาโกโตะ เทกุระโมริ” หลังผลงานไม่เป็นตามเป้า</ion-col>
51
+    </ion-row>
52
+    <ion-row>
53
+      <ion-col>
54
+        <img src="../../../assets/img-static/banner-320x50.jpeg" alt="">
55
+      </ion-col>
56
+    </ion-row>
57
+    <ion-row>
58
+      <ion-col>
59
+        <h2>รายการย้อนหลัง</h2>
60
+      </ion-col>
61
+    </ion-row>
62
+    <ion-row>
63
+      <ion-col size="5">
64
+        <img src="../../assets/img-static/mqdefault-1.jpg">
65
+      </ion-col>
66
+      <ion-col>Morning Talk [26-10-2022 l 07:30 - 09:00 น. ]</ion-col>
67
+    </ion-row>
68
+    <ion-row>
69
+      <ion-col size="5">
70
+        <img src="../../assets/img-static/mqdefault-2.jpg">
71
+      </ion-col>
72
+      <ion-col>Golf Trick [26-10-2022 l 09:00 - 10:00 น.]</ion-col>
73
+    </ion-row>
74
+    <ion-row>
75
+      <ion-col size="5">
76
+        <img src="../../assets/img-static/mqdefault-3.jpg">
77
+      </ion-col>
78
+      <ion-col>เจาะสนามบอลไทย [ 20-10-2022 l 20:00 - 21:30 น. ]</ion-col>
79
+    </ion-row>
80
+    <ion-row>
81
+      <ion-col>
82
+        <img src="../../../assets/img-static/banner-320x100.jpeg" alt="">
83
+      </ion-col>
84
+    </ion-row>
85
+  </ion-grid>
86
+</ion-content>

+ 39 - 0
src/app/home/home.page.scss

@@ -0,0 +1,39 @@
1
+
2
+// ion-title { text-align: center !important; }
3
+
4
+#container strong {
5
+  font-size: 20px;
6
+  line-height: 26px;
7
+}
8
+
9
+#container p {
10
+  font-size: 16px;
11
+  line-height: 22px;
12
+
13
+  color: #8c8c8c;
14
+
15
+  margin: 0;
16
+}
17
+
18
+#container a {
19
+  text-decoration: none;
20
+}
21
+
22
+// .swiper .swiper-slide {
23
+//   height: 100%;
24
+//   width: 100%;
25
+// }
26
+
27
+.swiper-slide {
28
+  // display: flex;
29
+  // flex-direction: column;
30
+  // align-items: center;
31
+  // justify-content: center;
32
+  background-color: blueviolet;
33
+}
34
+
35
+ion-content{ 
36
+  font-family:IBM Plex Sans Thai SemiBold !important;
37
+  font-size:1em;
38
+  line-height: 1.4em;
39
+}

+ 24 - 0
src/app/home/home.page.spec.ts

@@ -0,0 +1,24 @@
1
+import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
+import { IonicModule } from '@ionic/angular';
3
+
4
+import { HomePage } from './home.page';
5
+
6
+describe('HomePage', () => {
7
+  let component: HomePage;
8
+  let fixture: ComponentFixture<HomePage>;
9
+
10
+  beforeEach(waitForAsync(() => {
11
+    TestBed.configureTestingModule({
12
+      declarations: [ HomePage ],
13
+      imports: [IonicModule.forRoot()]
14
+    }).compileComponents();
15
+
16
+    fixture = TestBed.createComponent(HomePage);
17
+    component = fixture.componentInstance;
18
+    fixture.detectChanges();
19
+  }));
20
+
21
+  it('should create', () => {
22
+    expect(component).toBeTruthy();
23
+  });
24
+});

+ 36 - 0
src/app/home/home.page.ts

@@ -0,0 +1,36 @@
1
+import { AfterContentChecked, Component, ViewChild, ViewEncapsulation } from '@angular/core';
2
+import {SwiperComponent} from 'swiper/angular';
3
+import { SwiperOptions } from 'swiper';
4
+import SwiperCore, { Pagination,Autoplay,Navigation,Keyboard } from 'swiper';
5
+
6
+SwiperCore.use([Pagination, Autoplay, Navigation, Keyboard]);
7
+@Component({
8
+  selector: 'app-home',
9
+  templateUrl: 'home.page.html',
10
+  styleUrls: ['home.page.scss'],
11
+  encapsulation: ViewEncapsulation.None
12
+})
13
+export class HomePage implements AfterContentChecked {
14
+  
15
+  @ViewChild('swiper') swiper: SwiperComponent;
16
+
17
+  config: SwiperOptions = {
18
+    slidesPerView: 1,  
19
+    pagination: { clickable: true },
20
+    autoplay: {
21
+      delay: 200,
22
+      disableOnInteraction: false,
23
+    },
24
+    loop: true,
25
+    navigation: true,
26
+  }
27
+
28
+  constructor() {}
29
+
30
+  ngAfterContentChecked() {
31
+    if (this.swiper) {
32
+      this.swiper.updateSwiper({});
33
+    }    
34
+  }
35
+
36
+}

+ 45 - 0
src/app/navtabs/navtabs-routing.module.ts

@@ -0,0 +1,45 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+
4
+import { NavtabsPage } from './navtabs.page';
5
+
6
+const routes: Routes = [
7
+  {
8
+    path: 'navtabsTab',
9
+    component: NavtabsPage,
10
+    children: [
11
+      {
12
+        path: 'home',
13
+        loadChildren: () => import('../home/home.module').then( m => m.HomePageModule)
14
+      },   
15
+      {
16
+        path: 'news',
17
+        loadChildren: () => import('../news/news.module').then( m => m.NewsPageModule)
18
+      },   
19
+      {
20
+        path: 'article',
21
+        loadChildren: () => import('../article/article.module').then( m => m.ArticlePageModule)
22
+      },   
23
+      {
24
+        path: 'youtube',
25
+        loadChildren: () => import('../youtube/youtube.module').then( m => m.YoutubePageModule)
26
+      }, 
27
+      {
28
+        path: '',
29
+        redirectTo: '/navtabs/navtabsTab/home',
30
+        pathMatch: 'full'
31
+      }
32
+    ]
33
+  },
34
+  {
35
+    path: '',
36
+    redirectTo: '/navtabs/navtabsTab/home',
37
+    pathMatch: 'full'    
38
+  }
39
+];
40
+
41
+@NgModule({
42
+  imports: [RouterModule.forChild(routes)],
43
+  exports: [RouterModule],
44
+})
45
+export class NavtabsPageRoutingModule {}

+ 20 - 0
src/app/navtabs/navtabs.module.ts

@@ -0,0 +1,20 @@
1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+import { FormsModule } from '@angular/forms';
4
+
5
+import { IonicModule } from '@ionic/angular';
6
+
7
+import { NavtabsPageRoutingModule } from './navtabs-routing.module';
8
+
9
+import { NavtabsPage } from './navtabs.page';
10
+
11
+@NgModule({
12
+  imports: [
13
+    CommonModule,
14
+    FormsModule,
15
+    IonicModule,
16
+    NavtabsPageRoutingModule
17
+  ],
18
+  declarations: [NavtabsPage]
19
+})
20
+export class NavtabsPageModule {}

+ 25 - 0
src/app/navtabs/navtabs.page.html

@@ -0,0 +1,25 @@
1
+
2
+<ion-tabs>
3
+  <ion-tab-bar slot="bottom">
4
+    <ion-tab-button tab="home">
5
+      <ion-icon name="globe"></ion-icon>
6
+      <!-- <ion-label>Home</ion-label> -->      
7
+    </ion-tab-button>
8
+    <ion-tab-button tab="news">
9
+      <ion-icon name="football"></ion-icon>
10
+      <!-- <ion-label>News</ion-label> -->
11
+    </ion-tab-button>
12
+    <ion-tab-button tab="#">
13
+      <ion-icon name="play-circle"></ion-icon>
14
+      <!-- <ion-label>Audio</ion-label> -->
15
+    </ion-tab-button>  
16
+    <ion-tab-button tab="youtube">
17
+      <ion-icon name="logo-youtube"></ion-icon>
18
+      <!-- <ion-label>Youtube</ion-label> -->
19
+    </ion-tab-button>  
20
+    <ion-tab-button tab="#">
21
+      <ion-icon name="videocam"></ion-icon>
22
+      <!-- <ion-label>Video</ion-label> -->
23
+    </ion-tab-button>
24
+  </ion-tab-bar>
25
+</ion-tabs>

+ 98 - 0
src/app/navtabs/navtabs.page.scss

@@ -0,0 +1,98 @@
1
+// ::ng-deep ion-icon.icon-button {
2
+//     background: #3c457e !important;
3
+//     color: white !important;
4
+//     border-radius: 50%!important;
5
+// }
6
+
7
+// :host ::ng-deep .tabs-inner {
8
+//     position: unset!important;
9
+//     contain: size style!important;
10
+//   }
11
+  
12
+//   .bottom-tab-bar {
13
+//     --background: transparent;
14
+//     --border: 0;
15
+//   }
16
+  
17
+//   ion-tab-button {
18
+//     --background: #134d80;
19
+//     --color:white;
20
+//     --color-selected: red;
21
+//     --ripple-color: white;
22
+//   }
23
+  
24
+
25
+// .button-center {
26
+//     --background: transparent!important;
27
+//     ion-icon {
28
+//       height: 40px;
29
+//       width: 40px;
30
+//       font-size: 60px;
31
+//     }
32
+// }
33
+// ion-tab-bar {
34
+//     &:before {
35
+//       box-shadow: 0 387px 0 300px #3c457e;
36
+//       position: absolute;
37
+//       margin-top: -48px;
38
+//       padding: 56px;
39
+//       border-radius: 65%;
40
+//       content: '';
41
+//     }
42
+//   }
43
+  
44
+// .inner-left-btn {
45
+//     border-radius: 0 50% 0 0; 
46
+//     //create the curved style on the left side of the center
47
+// }
48
+
49
+
50
+// .inner-right-btn {
51
+//     border-radius: 50% 0 0 0; 
52
+//     // create the curved style on the right side of the center
53
+// }
54
+  
55
+// .inner-center-btn {
56
+//     position: absolute;
57
+//     left: calc(50% - 35px); // position your button in the center
58
+//     bottom: 20px; // position button slightly above the half
59
+//     font-size: 70px;
60
+//     --background: transparent;
61
+// }
62
+
63
+// ion-tab-bar {
64
+//     overflow-x: scroll;
65
+//     display: flex;    
66
+//     overflow-x: auto;
67
+//     ion-tab-button {
68
+//         display: inline-block;
69
+//         min-width: 100px;
70
+//         width: auto;
71
+//     }
72
+// }
73
+
74
+// ion-tab-bar {
75
+//   bottom: 20px;
76
+//   position: relative;
77
+//   border-radius: 16px;
78
+//   width: 92%;
79
+//   margin: 0 auto;
80
+// }
81
+
82
+// ion-tab-button {
83
+//   --color: var(--ion-color-medium);
84
+//   --color-selected: var(--ion-color-primary);
85
+
86
+//   &::before {
87
+//     background-color: transparent;
88
+//     display: block;
89
+//     content: "";
90
+//     margin: 0 auto;
91
+//     width: 20px;
92
+//     height: 2px;
93
+//   }
94
+
95
+//   &.tab-selected::before {
96
+//     background-color: var(--ion-color-primary);
97
+//   }
98
+// }

+ 24 - 0
src/app/navtabs/navtabs.page.spec.ts

@@ -0,0 +1,24 @@
1
+import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
+import { IonicModule } from '@ionic/angular';
3
+
4
+import { NavtabsPage } from './navtabs.page';
5
+
6
+describe('NavtabsPage', () => {
7
+  let component: NavtabsPage;
8
+  let fixture: ComponentFixture<NavtabsPage>;
9
+
10
+  beforeEach(waitForAsync(() => {
11
+    TestBed.configureTestingModule({
12
+      declarations: [ NavtabsPage ],
13
+      imports: [IonicModule.forRoot()]
14
+    }).compileComponents();
15
+
16
+    fixture = TestBed.createComponent(NavtabsPage);
17
+    component = fixture.componentInstance;
18
+    fixture.detectChanges();
19
+  }));
20
+
21
+  it('should create', () => {
22
+    expect(component).toBeTruthy();
23
+  });
24
+});

+ 15 - 0
src/app/navtabs/navtabs.page.ts

@@ -0,0 +1,15 @@
1
+import { Component, OnInit } from '@angular/core';
2
+
3
+@Component({
4
+  selector: 'app-navtabs',
5
+  templateUrl: './navtabs.page.html',
6
+  styleUrls: ['./navtabs.page.scss'],
7
+})
8
+export class NavtabsPage implements OnInit {
9
+
10
+  constructor() { }
11
+
12
+  ngOnInit() {
13
+  }
14
+
15
+}

+ 17 - 0
src/app/news/news-routing.module.ts

@@ -0,0 +1,17 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+
4
+import { NewsPage } from './news.page';
5
+
6
+const routes: Routes = [
7
+  {
8
+    path: '',
9
+    component: NewsPage
10
+  }
11
+];
12
+
13
+@NgModule({
14
+  imports: [RouterModule.forChild(routes)],
15
+  exports: [RouterModule],
16
+})
17
+export class NewsPageRoutingModule {}

+ 22 - 0
src/app/news/news.module.ts

@@ -0,0 +1,22 @@
1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+import { FormsModule } from '@angular/forms';
4
+
5
+import { IonicModule } from '@ionic/angular';
6
+
7
+import { NewsPageRoutingModule } from './news-routing.module';
8
+
9
+import { NewsPage } from './news.page';
10
+import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'
11
+
12
+@NgModule({
13
+  imports: [
14
+    CommonModule,
15
+    FormsModule,
16
+    IonicModule,
17
+    NewsPageRoutingModule,
18
+    FontAwesomeModule,
19
+  ],
20
+  declarations: [NewsPage]
21
+})
22
+export class NewsPageModule {}

+ 72 - 0
src/app/news/news.page.html

@@ -0,0 +1,72 @@
1
+<ion-header [translucent]="true">
2
+  <ion-toolbar>
3
+    <ion-buttons slot="end">
4
+      <ion-menu-button></ion-menu-button>
5
+    </ion-buttons>
6
+    <img src="../../../assets/icon/logo-fm99.png" class="head-img">
7
+  </ion-toolbar>
8
+</ion-header>
9
+
10
+<ion-content>
11
+  <img src="../../../assets/img-static/banner-320x50.jpeg" alt="">
12
+  <ion-grid>
13
+    <ion-row>
14
+      <ion-col>
15
+        <h2>ข่าวกีฬา</h2>
16
+      </ion-col>
17
+    </ion-row>
18
+    <ion-row>
19
+      <ion-col size="5">
20
+        <img src="../../assets/img-static/SEI129887404-c4a9.jpg">
21
+      </ion-col>
22
+      <ion-col>“น้องเทนนิส” หวังคว้าแชมป์ในศึกชิงแชมป์โลก ต้นเดือนหน้า</ion-col>
23
+    </ion-row>
24
+    <ion-row>
25
+      <ion-col size="5">
26
+        <img src="../../assets/img-static/SEI129887404-c4a9.jpg">
27
+      </ion-col>
28
+      <ion-col>โรนัลโด กลับมาซ้อมกับทีม พร้อมปรับความเข้าใจกับ เทน ฮาก</ion-col>
29
+    </ion-row>
30
+    <ion-row>
31
+      <ion-col size="5">
32
+        <img src="../../assets/img-static/SEI129887404-c4a9.jpg">
33
+      </ion-col>
34
+      <ion-col>เตรียมหารือบอร์ดหาข้อสรุป รัฐ-เอกชน จับมือยิงสดฟุตบอลโลก</ion-col>
35
+    </ion-row>
36
+    <ion-row>
37
+      <ion-col size="5">
38
+        <img src="../../assets/img-static/SEI129887404-c4a9.jpg">
39
+      </ion-col>
40
+      <ion-col>บีจี แยกทางกับ “มาโกโตะ เทกุระโมริ” หลังผลงานไม่เป็นตามเป้า</ion-col>
41
+    </ion-row>
42
+    <ion-row>
43
+      <ion-col size="5">
44
+        <img src="../../assets/img-static/SEI129887404-c4a9.jpg">
45
+      </ion-col>
46
+      <ion-col>“น้องเทนนิส” หวังคว้าแชมป์ในศึกชิงแชมป์โลก ต้นเดือนหน้า</ion-col>
47
+    </ion-row>
48
+    <ion-row>
49
+      <ion-col size="5">
50
+        <img src="../../assets/img-static/SEI129887404-c4a9.jpg">
51
+      </ion-col>
52
+      <ion-col>โรนัลโด กลับมาซ้อมกับทีม พร้อมปรับความเข้าใจกับ เทน ฮาก</ion-col>
53
+    </ion-row>
54
+    <ion-row>
55
+      <ion-col size="5">
56
+        <img src="../../assets/img-static/SEI129887404-c4a9.jpg">
57
+      </ion-col>
58
+      <ion-col>เตรียมหารือบอร์ดหาข้อสรุป รัฐ-เอกชน จับมือยิงสดฟุตบอลโลก</ion-col>
59
+    </ion-row>
60
+    <ion-row>
61
+      <ion-col size="5">
62
+        <img src="../../assets/img-static/SEI129887404-c4a9.jpg">
63
+      </ion-col>
64
+      <ion-col>บีจี แยกทางกับ “มาโกโตะ เทกุระโมริ” หลังผลงานไม่เป็นตามเป้า</ion-col>
65
+    </ion-row> 
66
+    <ion-row>
67
+      <ion-col>
68
+        <img src="../../../assets/img-static/banner-320x100.jpeg" alt="">
69
+      </ion-col>
70
+    </ion-row>
71
+  </ion-grid>
72
+</ion-content>

+ 0 - 0
src/app/news/news.page.scss


+ 24 - 0
src/app/news/news.page.spec.ts

@@ -0,0 +1,24 @@
1
+import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
+import { IonicModule } from '@ionic/angular';
3
+
4
+import { NewsPage } from './news.page';
5
+
6
+describe('NewsPage', () => {
7
+  let component: NewsPage;
8
+  let fixture: ComponentFixture<NewsPage>;
9
+
10
+  beforeEach(waitForAsync(() => {
11
+    TestBed.configureTestingModule({
12
+      declarations: [ NewsPage ],
13
+      imports: [IonicModule.forRoot()]
14
+    }).compileComponents();
15
+
16
+    fixture = TestBed.createComponent(NewsPage);
17
+    component = fixture.componentInstance;
18
+    fixture.detectChanges();
19
+  }));
20
+
21
+  it('should create', () => {
22
+    expect(component).toBeTruthy();
23
+  });
24
+});

+ 15 - 0
src/app/news/news.page.ts

@@ -0,0 +1,15 @@
1
+import { Component, OnInit } from '@angular/core';
2
+
3
+@Component({
4
+  selector: 'app-news',
5
+  templateUrl: './news.page.html',
6
+  styleUrls: ['./news.page.scss'],
7
+})
8
+export class NewsPage implements OnInit {
9
+
10
+  constructor() { }
11
+
12
+  ngOnInit() {
13
+  }
14
+
15
+}

+ 17 - 0
src/app/youtube/youtube-routing.module.ts

@@ -0,0 +1,17 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+
4
+import { YoutubePage } from './youtube.page';
5
+
6
+const routes: Routes = [
7
+  {
8
+    path: '',
9
+    component: YoutubePage
10
+  }
11
+];
12
+
13
+@NgModule({
14
+  imports: [RouterModule.forChild(routes)],
15
+  exports: [RouterModule],
16
+})
17
+export class YoutubePageRoutingModule {}

+ 20 - 0
src/app/youtube/youtube.module.ts

@@ -0,0 +1,20 @@
1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+import { FormsModule } from '@angular/forms';
4
+
5
+import { IonicModule } from '@ionic/angular';
6
+
7
+import { YoutubePageRoutingModule } from './youtube-routing.module';
8
+
9
+import { YoutubePage } from './youtube.page';
10
+
11
+@NgModule({
12
+  imports: [
13
+    CommonModule,
14
+    FormsModule,
15
+    IonicModule,
16
+    YoutubePageRoutingModule
17
+  ],
18
+  declarations: [YoutubePage]
19
+})
20
+export class YoutubePageModule {}

+ 42 - 0
src/app/youtube/youtube.page.html

@@ -0,0 +1,42 @@
1
+<ion-header [translucent]="true">
2
+  <ion-toolbar>
3
+    <ion-buttons slot="end">
4
+      <ion-menu-button></ion-menu-button>
5
+    </ion-buttons>
6
+    <img src="../../../assets/icon/logo-fm99.png" class="head-img">
7
+  </ion-toolbar>
8
+</ion-header>
9
+
10
+<ion-content>
11
+  <img src="../../../assets/img-static/banner-320x50.jpeg" alt="">
12
+  <ion-grid>
13
+    <ion-row>
14
+      <ion-col>
15
+        <h2>รายการย้อนหลัง</h2>
16
+      </ion-col>
17
+    </ion-row>
18
+    <ion-row>
19
+      <ion-col size="5">
20
+        <img src="../../assets/img-static/mqdefault-1.jpg">
21
+      </ion-col>
22
+      <ion-col>Morning Talk [26-10-2022 l 07:30 - 09:00 น. ]</ion-col>
23
+    </ion-row>
24
+    <ion-row>
25
+      <ion-col size="5">
26
+        <img src="../../assets/img-static/mqdefault-2.jpg">
27
+      </ion-col>
28
+      <ion-col>Golf Trick [26-10-2022 l 09:00 - 10:00 น.]</ion-col>
29
+    </ion-row>
30
+    <ion-row>
31
+      <ion-col size="5">
32
+        <img src="../../assets/img-static/mqdefault-3.jpg">
33
+      </ion-col>
34
+      <ion-col>เจาะสนามบอลไทย [ 20-10-2022 l 20:00 - 21:30 น. ]</ion-col>
35
+    </ion-row>
36
+    <ion-row>
37
+      <ion-col>
38
+        <img src="../../../assets/img-static/banner-320x100.jpeg" alt="">
39
+      </ion-col>
40
+    </ion-row>
41
+  </ion-grid>
42
+</ion-content>

+ 0 - 0
src/app/youtube/youtube.page.scss


+ 24 - 0
src/app/youtube/youtube.page.spec.ts

@@ -0,0 +1,24 @@
1
+import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
+import { IonicModule } from '@ionic/angular';
3
+
4
+import { YoutubePage } from './youtube.page';
5
+
6
+describe('YoutubePage', () => {
7
+  let component: YoutubePage;
8
+  let fixture: ComponentFixture<YoutubePage>;
9
+
10
+  beforeEach(waitForAsync(() => {
11
+    TestBed.configureTestingModule({
12
+      declarations: [ YoutubePage ],
13
+      imports: [IonicModule.forRoot()]
14
+    }).compileComponents();
15
+
16
+    fixture = TestBed.createComponent(YoutubePage);
17
+    component = fixture.componentInstance;
18
+    fixture.detectChanges();
19
+  }));
20
+
21
+  it('should create', () => {
22
+    expect(component).toBeTruthy();
23
+  });
24
+});

+ 15 - 0
src/app/youtube/youtube.page.ts

@@ -0,0 +1,15 @@
1
+import { Component, OnInit } from '@angular/core';
2
+
3
+@Component({
4
+  selector: 'app-youtube',
5
+  templateUrl: './youtube.page.html',
6
+  styleUrls: ['./youtube.page.scss'],
7
+})
8
+export class YoutubePage implements OnInit {
9
+
10
+  constructor() { }
11
+
12
+  ngOnInit() {
13
+  }
14
+
15
+}

二进制
src/assets/fonts/IBMPlexSansThai-Regular.ttf


二进制
src/assets/fonts/IBMPlexSansThai-SemiBold.ttf


二进制
src/assets/fonts/K2D-Light.ttf


二进制
src/assets/fonts/Montserrat-Medium.ttf


二进制
src/assets/fonts/Montserrat-SemiBold.ttf


二进制
src/assets/fonts/Prompt-Light.ttf


二进制
src/assets/fonts/Prompt-Medium.ttf


二进制
src/assets/icon/favicon.png


二进制
src/assets/icon/logo-fm99.png


二进制
src/assets/img-static/SEI129887404-c4a9.jpg


二进制
src/assets/img-static/banner-250x250.jpeg


二进制
src/assets/img-static/banner-320x100.jpeg


二进制
src/assets/img-static/banner-320x50.jpeg


二进制
src/assets/img-static/fb-Ad-1.jpeg


二进制
src/assets/img-static/fb-Ad-2.jpeg


二进制
src/assets/img-static/fb-Ad-3.jpeg


二进制
src/assets/img-static/mqdefault-1.jpg


二进制
src/assets/img-static/mqdefault-2.jpg


二进制
src/assets/img-static/mqdefault-3.jpg


文件差异内容过多而无法显示
+ 1 - 0
src/assets/shapes.svg


+ 3 - 0
src/environments/environment.prod.ts

@@ -0,0 +1,3 @@
1
+export const environment = {
2
+  production: true
3
+};

+ 16 - 0
src/environments/environment.ts

@@ -0,0 +1,16 @@
1
+// This file can be replaced during build by using the `fileReplacements` array.
2
+// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3
+// The list of file replacements can be found in `angular.json`.
4
+
5
+export const environment = {
6
+  production: false
7
+};
8
+
9
+/*
10
+ * For easier debugging in development mode, you can import the following file
11
+ * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12
+ *
13
+ * This import should be commented out in production mode because it will have a negative impact
14
+ * on performance if an error is thrown.
15
+ */
16
+// import 'zone.js/dist/zone-error';  // Included with Angular CLI.

+ 106 - 0
src/global.scss

@@ -0,0 +1,106 @@
1
+/*
2
+ * App Global CSS
3
+ * ----------------------------------------------------------------------------
4
+ * Put style rules here that you want to apply globally. These styles are for
5
+ * the entire app and not just one component. Additionally, this file can be
6
+ * used as an entry point to import other CSS/Sass files to be included in the
7
+ * output CSS.
8
+ * For more information on global stylesheets, visit the documentation:
9
+ * https://ionicframework.com/docs/layout/global-stylesheets
10
+ */
11
+
12
+/* Core CSS required for Ionic components to work properly */
13
+@import "~@ionic/angular/css/core.css";
14
+
15
+/* Basic CSS for apps built with Ionic */
16
+@import "~@ionic/angular/css/normalize.css";
17
+@import "~@ionic/angular/css/structure.css";
18
+@import "~@ionic/angular/css/typography.css";
19
+@import '~@ionic/angular/css/display.css';
20
+
21
+/* Optional CSS utils that can be commented out */
22
+@import "~@ionic/angular/css/padding.css";
23
+@import "~@ionic/angular/css/float-elements.css";
24
+@import "~@ionic/angular/css/text-alignment.css";
25
+@import "~@ionic/angular/css/text-transformation.css";
26
+@import "~@ionic/angular/css/flex-utils.css";
27
+
28
+// @import "swiper/scss";
29
+// @import "swiper/scss/navigation.css";
30
+// @import "swiper/scss/autoplay";
31
+@import "@ionic/angular/css/ionic-swiper";
32
+@import "swiper/scss";
33
+@import "swiper/scss/navigation";
34
+@import "swiper/scss/pagination";
35
+@import "swiper/scss/autoplay";
36
+// @import "swiper/css/bundle";
37
+// @import "swiper/css/autoplay";
38
+// @import "~swiper/swiper-bundle";
39
+// @import "swiper/scss";
40
+// @import "swiper/scss/autoplay";
41
+// @import "swiper/scss/keyboard";
42
+// @import "swiper/scss/pagination";
43
+// @import "swiper/scss/scrollbar";
44
+// @import "swiper/scss/zoom";
45
+
46
+
47
+
48
+@font-face {
49
+    font-family: "IBM Plex Sans Thai";
50
+    font-style: normal;
51
+    font-weight: normal;
52
+    src: url("./assets/fonts/IBMPlexSansThai-Regular.ttf");
53
+  }
54
+
55
+  @font-face {
56
+    font-family: "IBM Plex Sans Thai SemiBold";
57
+    font-style: normal;
58
+    font-weight: normal;
59
+    src: url("./assets/fonts/IBMPlexSansThai-SemiBold.ttf");
60
+  }  
61
+  @font-face {
62
+    font-family: "Prompt";
63
+    font-style: normal;
64
+    font-weight: normal;
65
+    src: url("./assets/fonts/Prompt-Medium.ttf");
66
+  }  
67
+  @font-face {
68
+    font-family: "Montserrat";
69
+    font-style: normal;
70
+    font-weight: normal;
71
+    src: url("./assets/fonts/Montserrat-Medium.ttf");
72
+  }   
73
+
74
+  @font-face {
75
+    font-family: "K2D";
76
+    font-style: normal;
77
+    font-weight: normal;
78
+    src: url("./assets/fonts/K2D-Light.ttf");
79
+  }  
80
+
81
+
82
+ion-title {
83
+    font-family:Montserrat !important;
84
+    font-size:1.4em;    
85
+}
86
+
87
+
88
+h2{
89
+    font-family:Prompt !important;
90
+    font-size:1.3em;
91
+    margin-top: 5px;
92
+    margin-bottom: 0px;
93
+
94
+}
95
+
96
+h3{
97
+    font-family:IBM Plex Sans Thai SemiBold !important;
98
+    font-size:1.3em;    
99
+}
100
+
101
+.head-img {
102
+  width: 15%;
103
+  display: flex;
104
+  margin-left:10px;
105
+  margin-top:5px;
106
+}

+ 26 - 0
src/index.html

@@ -0,0 +1,26 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+
4
+<head>
5
+  <meta charset="utf-8" />
6
+  <title>Ionic App</title>
7
+
8
+  <base href="/" />
9
+
10
+  <meta name="color-scheme" content="light dark" />
11
+  <meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
12
+  <meta name="format-detection" content="telephone=no" />
13
+  <meta name="msapplication-tap-highlight" content="no" />
14
+
15
+  <link rel="icon" type="image/png" href="assets/icon/favicon.png" />
16
+
17
+  <!-- add to homescreen for ios -->
18
+  <meta name="apple-mobile-web-app-capable" content="yes" />
19
+  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
20
+</head>
21
+
22
+<body>
23
+  <app-root></app-root>
24
+</body>
25
+
26
+</html>

+ 12 - 0
src/main.ts

@@ -0,0 +1,12 @@
1
+import { enableProdMode } from '@angular/core';
2
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3
+
4
+import { AppModule } from './app/app.module';
5
+import { environment } from './environments/environment';
6
+
7
+if (environment.production) {
8
+  enableProdMode();
9
+}
10
+
11
+platformBrowserDynamic().bootstrapModule(AppModule)
12
+  .catch(err => console.log(err));

+ 65 - 0
src/polyfills.ts

@@ -0,0 +1,65 @@
1
+/**
2
+ * This file includes polyfills needed by Angular and is loaded before the app.
3
+ * You can add your own extra polyfills to this file.
4
+ *
5
+ * This file is divided into 2 sections:
6
+ *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7
+ *   2. Application imports. Files imported after ZoneJS that should be loaded before your main
8
+ *      file.
9
+ *
10
+ * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11
+ * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12
+ * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13
+ *
14
+ * Learn more in https://angular.io/guide/browser-support
15
+ */
16
+
17
+/***************************************************************************************************
18
+ * BROWSER POLYFILLS
19
+ */
20
+
21
+/** IE11 requires the following for NgClass support on SVG elements */
22
+// import 'classlist.js';  // Run `npm install --save classlist.js`.
23
+
24
+/**
25
+ * Web Animations `@angular/platform-browser/animations`
26
+ * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
27
+ * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
28
+ */
29
+// import 'web-animations-js';  // Run `npm install --save web-animations-js`.
30
+
31
+/**
32
+ * By default, zone.js will patch all possible macroTask and DomEvents
33
+ * user can disable parts of macroTask/DomEvents patch by setting following flags
34
+ * because those flags need to be set before `zone.js` being loaded, and webpack
35
+ * will put import in the top of bundle, so user need to create a separate file
36
+ * in this directory (for example: zone-flags.ts), and put the following flags
37
+ * into that file, and then add the following code before importing zone.js.
38
+ * import './zone-flags';
39
+ *
40
+ * The flags allowed in zone-flags.ts are listed here.
41
+ *
42
+ * The following flags will work for all browsers.
43
+ *
44
+ * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
45
+ * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
46
+ * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
47
+ *
48
+ *  in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
49
+ *  with the following flag, it will bypass `zone.js` patch for IE/Edge
50
+ *
51
+ *  (window as any).__Zone_enable_cross_context_check = true;
52
+ *
53
+ */
54
+
55
+import './zone-flags';
56
+
57
+/***************************************************************************************************
58
+ * Zone JS is required by default for Angular itself.
59
+ */
60
+import 'zone.js/dist/zone';  // Included with Angular CLI.
61
+
62
+
63
+/***************************************************************************************************
64
+ * APPLICATION IMPORTS
65
+ */

+ 25 - 0
src/test.ts

@@ -0,0 +1,25 @@
1
+// This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
+
3
+import 'zone.js/dist/zone-testing';
4
+import { getTestBed } from '@angular/core/testing';
5
+import {
6
+  BrowserDynamicTestingModule,
7
+  platformBrowserDynamicTesting
8
+} from '@angular/platform-browser-dynamic/testing';
9
+
10
+declare const require: {
11
+  context(path: string, deep?: boolean, filter?: RegExp): {
12
+    <T>(id: string): T;
13
+    keys(): string[];
14
+  };
15
+};
16
+
17
+// First, initialize the Angular testing environment.
18
+getTestBed().initTestEnvironment(
19
+  BrowserDynamicTestingModule,
20
+  platformBrowserDynamicTesting()
21
+);
22
+// Then we find all the tests.
23
+const context = require.context('./', true, /\.spec\.ts$/);
24
+// And load the modules.
25
+context.keys().map(context);

+ 236 - 0
src/theme/variables.scss

@@ -0,0 +1,236 @@
1
+// Ionic Variables and Theming. For more info, please see:
2
+// http://ionicframework.com/docs/theming/
3
+
4
+/** Ionic CSS Variables **/
5
+:root {
6
+  /** primary **/
7
+  --ion-color-primary: #3880ff;
8
+  --ion-color-primary-rgb: 56, 128, 255;
9
+  --ion-color-primary-contrast: #ffffff;
10
+  --ion-color-primary-contrast-rgb: 255, 255, 255;
11
+  --ion-color-primary-shade: #3171e0;
12
+  --ion-color-primary-tint: #4c8dff;
13
+
14
+  /** secondary **/
15
+  --ion-color-secondary: #3dc2ff;
16
+  --ion-color-secondary-rgb: 61, 194, 255;
17
+  --ion-color-secondary-contrast: #ffffff;
18
+  --ion-color-secondary-contrast-rgb: 255, 255, 255;
19
+  --ion-color-secondary-shade: #36abe0;
20
+  --ion-color-secondary-tint: #50c8ff;
21
+
22
+  /** tertiary **/
23
+  --ion-color-tertiary: #5260ff;
24
+  --ion-color-tertiary-rgb: 82, 96, 255;
25
+  --ion-color-tertiary-contrast: #ffffff;
26
+  --ion-color-tertiary-contrast-rgb: 255, 255, 255;
27
+  --ion-color-tertiary-shade: #4854e0;
28
+  --ion-color-tertiary-tint: #6370ff;
29
+
30
+  /** success **/
31
+  --ion-color-success: #2dd36f;
32
+  --ion-color-success-rgb: 45, 211, 111;
33
+  --ion-color-success-contrast: #ffffff;
34
+  --ion-color-success-contrast-rgb: 255, 255, 255;
35
+  --ion-color-success-shade: #28ba62;
36
+  --ion-color-success-tint: #42d77d;
37
+
38
+  /** warning **/
39
+  --ion-color-warning: #ffc409;
40
+  --ion-color-warning-rgb: 255, 196, 9;
41
+  --ion-color-warning-contrast: #000000;
42
+  --ion-color-warning-contrast-rgb: 0, 0, 0;
43
+  --ion-color-warning-shade: #e0ac08;
44
+  --ion-color-warning-tint: #ffca22;
45
+
46
+  /** danger **/
47
+  --ion-color-danger: #eb445a;
48
+  --ion-color-danger-rgb: 235, 68, 90;
49
+  --ion-color-danger-contrast: #ffffff;
50
+  --ion-color-danger-contrast-rgb: 255, 255, 255;
51
+  --ion-color-danger-shade: #cf3c4f;
52
+  --ion-color-danger-tint: #ed576b;
53
+
54
+  /** dark **/
55
+  --ion-color-dark: #222428;
56
+  --ion-color-dark-rgb: 34, 36, 40;
57
+  --ion-color-dark-contrast: #ffffff;
58
+  --ion-color-dark-contrast-rgb: 255, 255, 255;
59
+  --ion-color-dark-shade: #1e2023;
60
+  --ion-color-dark-tint: #383a3e;
61
+
62
+  /** medium **/
63
+  --ion-color-medium: #92949c;
64
+  --ion-color-medium-rgb: 146, 148, 156;
65
+  --ion-color-medium-contrast: #ffffff;
66
+  --ion-color-medium-contrast-rgb: 255, 255, 255;
67
+  --ion-color-medium-shade: #808289;
68
+  --ion-color-medium-tint: #9d9fa6;
69
+
70
+  /** light **/
71
+  --ion-color-light: #f4f5f8;
72
+  --ion-color-light-rgb: 244, 245, 248;
73
+  --ion-color-light-contrast: #000000;
74
+  --ion-color-light-contrast-rgb: 0, 0, 0;
75
+  --ion-color-light-shade: #d7d8da;
76
+  --ion-color-light-tint: #f5f6f9;
77
+}
78
+
79
+@media (prefers-color-scheme: dark) {
80
+  /*
81
+   * Dark Colors
82
+   * -------------------------------------------
83
+   */
84
+
85
+  body {
86
+    --ion-color-primary: #428cff;
87
+    --ion-color-primary-rgb: 66,140,255;
88
+    --ion-color-primary-contrast: #ffffff;
89
+    --ion-color-primary-contrast-rgb: 255,255,255;
90
+    --ion-color-primary-shade: #3a7be0;
91
+    --ion-color-primary-tint: #5598ff;
92
+
93
+    --ion-color-secondary: #50c8ff;
94
+    --ion-color-secondary-rgb: 80,200,255;
95
+    --ion-color-secondary-contrast: #ffffff;
96
+    --ion-color-secondary-contrast-rgb: 255,255,255;
97
+    --ion-color-secondary-shade: #46b0e0;
98
+    --ion-color-secondary-tint: #62ceff;
99
+
100
+    --ion-color-tertiary: #6a64ff;
101
+    --ion-color-tertiary-rgb: 106,100,255;
102
+    --ion-color-tertiary-contrast: #ffffff;
103
+    --ion-color-tertiary-contrast-rgb: 255,255,255;
104
+    --ion-color-tertiary-shade: #5d58e0;
105
+    --ion-color-tertiary-tint: #7974ff;
106
+
107
+    --ion-color-success: #2fdf75;
108
+    --ion-color-success-rgb: 47,223,117;
109
+    --ion-color-success-contrast: #000000;
110
+    --ion-color-success-contrast-rgb: 0,0,0;
111
+    --ion-color-success-shade: #29c467;
112
+    --ion-color-success-tint: #44e283;
113
+
114
+    --ion-color-warning: #ffd534;
115
+    --ion-color-warning-rgb: 255,213,52;
116
+    --ion-color-warning-contrast: #000000;
117
+    --ion-color-warning-contrast-rgb: 0,0,0;
118
+    --ion-color-warning-shade: #e0bb2e;
119
+    --ion-color-warning-tint: #ffd948;
120
+
121
+    --ion-color-danger: #ff4961;
122
+    --ion-color-danger-rgb: 255,73,97;
123
+    --ion-color-danger-contrast: #ffffff;
124
+    --ion-color-danger-contrast-rgb: 255,255,255;
125
+    --ion-color-danger-shade: #e04055;
126
+    --ion-color-danger-tint: #ff5b71;
127
+
128
+    --ion-color-dark: #f4f5f8;
129
+    --ion-color-dark-rgb: 244,245,248;
130
+    --ion-color-dark-contrast: #000000;
131
+    --ion-color-dark-contrast-rgb: 0,0,0;
132
+    --ion-color-dark-shade: #d7d8da;
133
+    --ion-color-dark-tint: #f5f6f9;
134
+
135
+    --ion-color-medium: #989aa2;
136
+    --ion-color-medium-rgb: 152,154,162;
137
+    --ion-color-medium-contrast: #000000;
138
+    --ion-color-medium-contrast-rgb: 0,0,0;
139
+    --ion-color-medium-shade: #86888f;
140
+    --ion-color-medium-tint: #a2a4ab;
141
+
142
+    --ion-color-light: #222428;
143
+    --ion-color-light-rgb: 34,36,40;
144
+    --ion-color-light-contrast: #ffffff;
145
+    --ion-color-light-contrast-rgb: 255,255,255;
146
+    --ion-color-light-shade: #1e2023;
147
+    --ion-color-light-tint: #383a3e;
148
+  }
149
+
150
+  /*
151
+   * iOS Dark Theme
152
+   * -------------------------------------------
153
+   */
154
+
155
+  .ios body {
156
+    --ion-background-color: #000000;
157
+    --ion-background-color-rgb: 0,0,0;
158
+
159
+    --ion-text-color: #ffffff;
160
+    --ion-text-color-rgb: 255,255,255;
161
+
162
+    --ion-color-step-50: #0d0d0d;
163
+    --ion-color-step-100: #1a1a1a;
164
+    --ion-color-step-150: #262626;
165
+    --ion-color-step-200: #333333;
166
+    --ion-color-step-250: #404040;
167
+    --ion-color-step-300: #4d4d4d;
168
+    --ion-color-step-350: #595959;
169
+    --ion-color-step-400: #666666;
170
+    --ion-color-step-450: #737373;
171
+    --ion-color-step-500: #808080;
172
+    --ion-color-step-550: #8c8c8c;
173
+    --ion-color-step-600: #999999;
174
+    --ion-color-step-650: #a6a6a6;
175
+    --ion-color-step-700: #b3b3b3;
176
+    --ion-color-step-750: #bfbfbf;
177
+    --ion-color-step-800: #cccccc;
178
+    --ion-color-step-850: #d9d9d9;
179
+    --ion-color-step-900: #e6e6e6;
180
+    --ion-color-step-950: #f2f2f2;
181
+
182
+    --ion-item-background: #000000;
183
+
184
+    --ion-card-background: #1c1c1d;
185
+  }
186
+
187
+  .ios ion-modal {
188
+    --ion-background-color: var(--ion-color-step-100);
189
+    --ion-toolbar-background: var(--ion-color-step-150);
190
+    --ion-toolbar-border-color: var(--ion-color-step-250);
191
+  }
192
+
193
+
194
+  /*
195
+   * Material Design Dark Theme
196
+   * -------------------------------------------
197
+   */
198
+
199
+  .md body {
200
+    --ion-background-color: #121212;
201
+    --ion-background-color-rgb: 18,18,18;
202
+
203
+    --ion-text-color: #ffffff;
204
+    --ion-text-color-rgb: 255,255,255;
205
+
206
+    --ion-border-color: #222222;
207
+
208
+    --ion-color-step-50: #1e1e1e;
209
+    --ion-color-step-100: #2a2a2a;
210
+    --ion-color-step-150: #363636;
211
+    --ion-color-step-200: #414141;
212
+    --ion-color-step-250: #4d4d4d;
213
+    --ion-color-step-300: #595959;
214
+    --ion-color-step-350: #656565;
215
+    --ion-color-step-400: #717171;
216
+    --ion-color-step-450: #7d7d7d;
217
+    --ion-color-step-500: #898989;
218
+    --ion-color-step-550: #949494;
219
+    --ion-color-step-600: #a0a0a0;
220
+    --ion-color-step-650: #acacac;
221
+    --ion-color-step-700: #b8b8b8;
222
+    --ion-color-step-750: #c4c4c4;
223
+    --ion-color-step-800: #d0d0d0;
224
+    --ion-color-step-850: #dbdbdb;
225
+    --ion-color-step-900: #e7e7e7;
226
+    --ion-color-step-950: #f3f3f3;
227
+
228
+    --ion-item-background: #1e1e1e;
229
+
230
+    --ion-toolbar-background: #1f1f1f;
231
+
232
+    --ion-tab-bar-background: #1f1f1f;
233
+
234
+    --ion-card-background: #1e1e1e;
235
+  }
236
+}

+ 6 - 0
src/zone-flags.ts

@@ -0,0 +1,6 @@
1
+/**
2
+ * Prevents Angular change detection from
3
+ * running with certain Web Component callbacks
4
+ */
5
+// eslint-disable-next-line no-underscore-dangle
6
+(window as any).__Zone_disable_customElements = true;

+ 15 - 0
tsconfig.app.json

@@ -0,0 +1,15 @@
1
+/* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+{
3
+  "extends": "./tsconfig.json",
4
+  "compilerOptions": {
5
+    "outDir": "./out-tsc/app",
6
+    "types": []
7
+  },
8
+  "files": [
9
+    "src/main.ts",
10
+    "src/polyfills.ts"
11
+  ],
12
+  "include": [
13
+    "src/**/*.d.ts"
14
+  ]
15
+}

+ 23 - 0
tsconfig.json

@@ -0,0 +1,23 @@
1
+/* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+{
3
+  "compileOnSave": false,
4
+  "compilerOptions": {
5
+    "baseUrl": "./",
6
+    "outDir": "./dist/out-tsc",
7
+    "sourceMap": true,
8
+    "declaration": false,
9
+    "downlevelIteration": true,
10
+    "experimentalDecorators": true,
11
+    "moduleResolution": "node",
12
+    "importHelpers": true,
13
+    "target": "es2015",
14
+    "module": "es2020",
15
+    "lib": ["es2018", "dom"]
16
+  },
17
+  "angularCompilerOptions": {
18
+    "enableI18nLegacyMessageIdFormat": false,
19
+    "strictInjectionParameters": true,
20
+    "strictInputAccessModifiers": true,
21
+    "strictTemplates": true
22
+  }
23
+}

+ 18 - 0
tsconfig.spec.json

@@ -0,0 +1,18 @@
1
+/* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+{
3
+  "extends": "./tsconfig.json",
4
+  "compilerOptions": {
5
+    "outDir": "./out-tsc/spec",
6
+    "types": [
7
+      "jasmine"
8
+    ]
9
+  },
10
+  "files": [
11
+    "src/test.ts",
12
+    "src/polyfills.ts"
13
+  ],
14
+  "include": [
15
+    "src/**/*.spec.ts",
16
+    "src/**/*.d.ts"
17
+  ]
18
+}

tum/whitesports - Gogs: Simplico Git Service

No Description

schema.php 41KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352
  1. <?php
  2. /**
  3. * WordPress Administration Scheme API
  4. *
  5. * Here we keep the DB structure and option values.
  6. *
  7. * @package WordPress
  8. * @subpackage Administration
  9. */
  10. /**
  11. * Declare these as global in case schema.php is included from a function.
  12. *
  13. * @global wpdb $wpdb WordPress database abstraction object.
  14. * @global array $wp_queries
  15. * @global string $charset_collate
  16. */
  17. global $wpdb, $wp_queries, $charset_collate;
  18. /**
  19. * The database character collate.
  20. */
  21. $charset_collate = $wpdb->get_charset_collate();
  22. /**
  23. * Retrieve the SQL for creating database tables.
  24. *
  25. * @since 3.3.0
  26. *
  27. * @global wpdb $wpdb WordPress database abstraction object.
  28. *
  29. * @param string $scope Optional. The tables for which to retrieve SQL. Can be all, global, ms_global, or blog tables. Defaults to all.
  30. * @param int $blog_id Optional. The site ID for which to retrieve SQL. Default is the current site ID.
  31. * @return string The SQL needed to create the requested tables.
  32. */
  33. function wp_get_db_schema( $scope = 'all', $blog_id = null ) {
  34. global $wpdb;
  35. $charset_collate = $wpdb->get_charset_collate();
  36. if ( $blog_id && $blog_id != $wpdb->blogid ) {
  37. $old_blog_id = $wpdb->set_blog_id( $blog_id );
  38. }
  39. // Engage multisite if in the middle of turning it on from network.php.
  40. $is_multisite = is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK );
  41. /*
  42. * Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that.
  43. * As of 4.2, however, we moved to utf8mb4, which uses 4 bytes per character. This means that an index which
  44. * used to have room for floor(767/3) = 255 characters, now only has room for floor(767/4) = 191 characters.
  45. */
  46. $max_index_length = 191;
  47. // Blog-specific tables.
  48. $blog_tables = "CREATE TABLE $wpdb->termmeta (
  49. meta_id bigint(20) unsigned NOT NULL auto_increment,
  50. term_id bigint(20) unsigned NOT NULL default '0',
  51. meta_key varchar(255) default NULL,
  52. meta_value longtext,
  53. PRIMARY KEY (meta_id),
  54. KEY term_id (term_id),
  55. KEY meta_key (meta_key($max_index_length))
  56. ) $charset_collate;
  57. CREATE TABLE $wpdb->terms (
  58. term_id bigint(20) unsigned NOT NULL auto_increment,
  59. name varchar(200) NOT NULL default '',
  60. slug varchar(200) NOT NULL default '',
  61. term_group bigint(10) NOT NULL default 0,
  62. PRIMARY KEY (term_id),
  63. KEY slug (slug($max_index_length)),
  64. KEY name (name($max_index_length))
  65. ) $charset_collate;
  66. CREATE TABLE $wpdb->term_taxonomy (
  67. term_taxonomy_id bigint(20) unsigned NOT NULL auto_increment,
  68. term_id bigint(20) unsigned NOT NULL default 0,
  69. taxonomy varchar(32) NOT NULL default '',
  70. description longtext NOT NULL,
  71. parent bigint(20) unsigned NOT NULL default 0,
  72. count bigint(20) NOT NULL default 0,
  73. PRIMARY KEY (term_taxonomy_id),
  74. UNIQUE KEY term_id_taxonomy (term_id,taxonomy),
  75. KEY taxonomy (taxonomy)
  76. ) $charset_collate;
  77. CREATE TABLE $wpdb->term_relationships (
  78. object_id bigint(20) unsigned NOT NULL default 0,
  79. term_taxonomy_id bigint(20) unsigned NOT NULL default 0,
  80. term_order int(11) NOT NULL default 0,
  81. PRIMARY KEY (object_id,term_taxonomy_id),
  82. KEY term_taxonomy_id (term_taxonomy_id)
  83. ) $charset_collate;
  84. CREATE TABLE $wpdb->commentmeta (
  85. meta_id bigint(20) unsigned NOT NULL auto_increment,
  86. comment_id bigint(20) unsigned NOT NULL default '0',
  87. meta_key varchar(255) default NULL,
  88. meta_value longtext,
  89. PRIMARY KEY (meta_id),
  90. KEY comment_id (comment_id),
  91. KEY meta_key (meta_key($max_index_length))
  92. ) $charset_collate;
  93. CREATE TABLE $wpdb->comments (
  94. comment_ID bigint(20) unsigned NOT NULL auto_increment,
  95. comment_post_ID bigint(20) unsigned NOT NULL default '0',
  96. comment_author tinytext NOT NULL,
  97. comment_author_email varchar(100) NOT NULL default '',
  98. comment_author_url varchar(200) NOT NULL default '',
  99. comment_author_IP varchar(100) NOT NULL default '',
  100. comment_date datetime NOT NULL default '0000-00-00 00:00:00',
  101. comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
  102. comment_content text NOT NULL,
  103. comment_karma int(11) NOT NULL default '0',
  104. comment_approved varchar(20) NOT NULL default '1',
  105. comment_agent varchar(255) NOT NULL default '',
  106. comment_type varchar(20) NOT NULL default 'comment',
  107. comment_parent bigint(20) unsigned NOT NULL default '0',
  108. user_id bigint(20) unsigned NOT NULL default '0',
  109. PRIMARY KEY (comment_ID),
  110. KEY comment_post_ID (comment_post_ID),
  111. KEY comment_approved_date_gmt (comment_approved,comment_date_gmt),
  112. KEY comment_date_gmt (comment_date_gmt),
  113. KEY comment_parent (comment_parent),
  114. KEY comment_author_email (comment_author_email(10))
  115. ) $charset_collate;
  116. CREATE TABLE $wpdb->links (
  117. link_id bigint(20) unsigned NOT NULL auto_increment,
  118. link_url varchar(255) NOT NULL default '',
  119. link_name varchar(255) NOT NULL default '',
  120. link_image varchar(255) NOT NULL default '',
  121. link_target varchar(25) NOT NULL default '',
  122. link_description varchar(255) NOT NULL default '',
  123. link_visible varchar(20) NOT NULL default 'Y',
  124. link_owner bigint(20) unsigned NOT NULL default '1',
  125. link_rating int(11) NOT NULL default '0',
  126. link_updated datetime NOT NULL default '0000-00-00 00:00:00',
  127. link_rel varchar(255) NOT NULL default '',
  128. link_notes mediumtext NOT NULL,
  129. link_rss varchar(255) NOT NULL default '',
  130. PRIMARY KEY (link_id),
  131. KEY link_visible (link_visible)
  132. ) $charset_collate;
  133. CREATE TABLE $wpdb->options (
  134. option_id bigint(20) unsigned NOT NULL auto_increment,
  135. option_name varchar(191) NOT NULL default '',
  136. option_value longtext NOT NULL,
  137. autoload varchar(20) NOT NULL default 'yes',
  138. PRIMARY KEY (option_id),
  139. UNIQUE KEY option_name (option_name),
  140. KEY autoload (autoload)
  141. ) $charset_collate;
  142. CREATE TABLE $wpdb->postmeta (
  143. meta_id bigint(20) unsigned NOT NULL auto_increment,
  144. post_id bigint(20) unsigned NOT NULL default '0',
  145. meta_key varchar(255) default NULL,
  146. meta_value longtext,
  147. PRIMARY KEY (meta_id),
  148. KEY post_id (post_id),
  149. KEY meta_key (meta_key($max_index_length))
  150. ) $charset_collate;
  151. CREATE TABLE $wpdb->posts (
  152. ID bigint(20) unsigned NOT NULL auto_increment,
  153. post_author bigint(20) unsigned NOT NULL default '0',
  154. post_date datetime NOT NULL default '0000-00-00 00:00:00',
  155. post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
  156. post_content longtext NOT NULL,
  157. post_title text NOT NULL,
  158. post_excerpt text NOT NULL,
  159. post_status varchar(20) NOT NULL default 'publish',
  160. comment_status varchar(20) NOT NULL default 'open',
  161. ping_status varchar(20) NOT NULL default 'open',
  162. post_password varchar(255) NOT NULL default '',
  163. post_name varchar(200) NOT NULL default '',
  164. to_ping text NOT NULL,
  165. pinged text NOT NULL,
  166. post_modified datetime NOT NULL default '0000-00-00 00:00:00',
  167. post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00',
  168. post_content_filtered longtext NOT NULL,
  169. post_parent bigint(20) unsigned NOT NULL default '0',
  170. guid varchar(255) NOT NULL default '',
  171. menu_order int(11) NOT NULL default '0',
  172. post_type varchar(20) NOT NULL default 'post',
  173. post_mime_type varchar(100) NOT NULL default '',
  174. comment_count bigint(20) NOT NULL default '0',
  175. PRIMARY KEY (ID),
  176. KEY post_name (post_name($max_index_length)),
  177. KEY type_status_date (post_type,post_status,post_date,ID),
  178. KEY post_parent (post_parent),
  179. KEY post_author (post_author)
  180. ) $charset_collate;\n";
  181. // Single site users table. The multisite flavor of the users table is handled below.
  182. $users_single_table = "CREATE TABLE $wpdb->users (
  183. ID bigint(20) unsigned NOT NULL auto_increment,
  184. user_login varchar(60) NOT NULL default '',
  185. user_pass varchar(255) NOT NULL default '',
  186. user_nicename varchar(50) NOT NULL default '',
  187. user_email varchar(100) NOT NULL default '',
  188. user_url varchar(100) NOT NULL default '',
  189. user_registered datetime NOT NULL default '0000-00-00 00:00:00',
  190. user_activation_key varchar(255) NOT NULL default '',
  191. user_status int(11) NOT NULL default '0',
  192. display_name varchar(250) NOT NULL default '',
  193. PRIMARY KEY (ID),
  194. KEY user_login_key (user_login),
  195. KEY user_nicename (user_nicename),
  196. KEY user_email (user_email)
  197. ) $charset_collate;\n";
  198. // Multisite users table.
  199. $users_multi_table = "CREATE TABLE $wpdb->users (
  200. ID bigint(20) unsigned NOT NULL auto_increment,
  201. user_login varchar(60) NOT NULL default '',
  202. user_pass varchar(255) NOT NULL default '',
  203. user_nicename varchar(50) NOT NULL default '',
  204. user_email varchar(100) NOT NULL default '',
  205. user_url varchar(100) NOT NULL default '',
  206. user_registered datetime NOT NULL default '0000-00-00 00:00:00',
  207. user_activation_key varchar(255) NOT NULL default '',
  208. user_status int(11) NOT NULL default '0',
  209. display_name varchar(250) NOT NULL default '',
  210. spam tinyint(2) NOT NULL default '0',
  211. deleted tinyint(2) NOT NULL default '0',
  212. PRIMARY KEY (ID),
  213. KEY user_login_key (user_login),
  214. KEY user_nicename (user_nicename),
  215. KEY user_email (user_email)
  216. ) $charset_collate;\n";
  217. // Usermeta.
  218. $usermeta_table = "CREATE TABLE $wpdb->usermeta (
  219. umeta_id bigint(20) unsigned NOT NULL auto_increment,
  220. user_id bigint(20) unsigned NOT NULL default '0',
  221. meta_key varchar(255) default NULL,
  222. meta_value longtext,
  223. PRIMARY KEY (umeta_id),
  224. KEY user_id (user_id),
  225. KEY meta_key (meta_key($max_index_length))
  226. ) $charset_collate;\n";
  227. // Global tables.
  228. if ( $is_multisite ) {
  229. $global_tables = $users_multi_table . $usermeta_table;
  230. } else {
  231. $global_tables = $users_single_table . $usermeta_table;
  232. }
  233. // Multisite global tables.
  234. $ms_global_tables = "CREATE TABLE $wpdb->blogs (
  235. blog_id bigint(20) NOT NULL auto_increment,
  236. site_id bigint(20) NOT NULL default '0',
  237. domain varchar(200) NOT NULL default '',
  238. path varchar(100) NOT NULL default '',
  239. registered datetime NOT NULL default '0000-00-00 00:00:00',
  240. last_updated datetime NOT NULL default '0000-00-00 00:00:00',
  241. public tinyint(2) NOT NULL default '1',
  242. archived tinyint(2) NOT NULL default '0',
  243. mature tinyint(2) NOT NULL default '0',
  244. spam tinyint(2) NOT NULL default '0',
  245. deleted tinyint(2) NOT NULL default '0',
  246. lang_id int(11) NOT NULL default '0',
  247. PRIMARY KEY (blog_id),
  248. KEY domain (domain(50),path(5)),
  249. KEY lang_id (lang_id)
  250. ) $charset_collate;
  251. CREATE TABLE $wpdb->blogmeta (
  252. meta_id bigint(20) unsigned NOT NULL auto_increment,
  253. blog_id bigint(20) NOT NULL default '0',
  254. meta_key varchar(255) default NULL,
  255. meta_value longtext,
  256. PRIMARY KEY (meta_id),
  257. KEY meta_key (meta_key($max_index_length)),
  258. KEY blog_id (blog_id)
  259. ) $charset_collate;
  260. CREATE TABLE $wpdb->registration_log (
  261. ID bigint(20) NOT NULL auto_increment,
  262. email varchar(255) NOT NULL default '',
  263. IP varchar(30) NOT NULL default '',
  264. blog_id bigint(20) NOT NULL default '0',
  265. date_registered datetime NOT NULL default '0000-00-00 00:00:00',
  266. PRIMARY KEY (ID),
  267. KEY IP (IP)
  268. ) $charset_collate;
  269. CREATE TABLE $wpdb->site (
  270. id bigint(20) NOT NULL auto_increment,
  271. domain varchar(200) NOT NULL default '',
  272. path varchar(100) NOT NULL default '',
  273. PRIMARY KEY (id),
  274. KEY domain (domain(140),path(51))
  275. ) $charset_collate;
  276. CREATE TABLE $wpdb->sitemeta (
  277. meta_id bigint(20) NOT NULL auto_increment,
  278. site_id bigint(20) NOT NULL default '0',
  279. meta_key varchar(255) default NULL,
  280. meta_value longtext,
  281. PRIMARY KEY (meta_id),
  282. KEY meta_key (meta_key($max_index_length)),
  283. KEY site_id (site_id)
  284. ) $charset_collate;
  285. CREATE TABLE $wpdb->signups (
  286. signup_id bigint(20) NOT NULL auto_increment,
  287. domain varchar(200) NOT NULL default '',
  288. path varchar(100) NOT NULL default '',
  289. title longtext NOT NULL,
  290. user_login varchar(60) NOT NULL default '',
  291. user_email varchar(100) NOT NULL default '',
  292. registered datetime NOT NULL default '0000-00-00 00:00:00',
  293. activated datetime NOT NULL default '0000-00-00 00:00:00',
  294. active tinyint(1) NOT NULL default '0',
  295. activation_key varchar(50) NOT NULL default '',
  296. meta longtext,
  297. PRIMARY KEY (signup_id),
  298. KEY activation_key (activation_key),
  299. KEY user_email (user_email),
  300. KEY user_login_email (user_login,user_email),
  301. KEY domain_path (domain(140),path(51))
  302. ) $charset_collate;";
  303. switch ( $scope ) {
  304. case 'blog':
  305. $queries = $blog_tables;
  306. break;
  307. case 'global':
  308. $queries = $global_tables;
  309. if ( $is_multisite ) {
  310. $queries .= $ms_global_tables;
  311. }
  312. break;
  313. case 'ms_global':
  314. $queries = $ms_global_tables;
  315. break;
  316. case 'all':
  317. default:
  318. $queries = $global_tables . $blog_tables;
  319. if ( $is_multisite ) {
  320. $queries .= $ms_global_tables;
  321. }
  322. break;
  323. }
  324. if ( isset( $old_blog_id ) ) {
  325. $wpdb->set_blog_id( $old_blog_id );
  326. }
  327. return $queries;
  328. }
  329. // Populate for back compat.
  330. $wp_queries = wp_get_db_schema( 'all' );
  331. /**
  332. * Create WordPress options and set the default values.
  333. *
  334. * @since 1.5.0
  335. * @since 5.1.0 The $options parameter has been added.
  336. *
  337. * @global wpdb $wpdb WordPress database abstraction object.
  338. * @global int $wp_db_version WordPress database version.
  339. * @global int $wp_current_db_version The old (current) database version.
  340. *
  341. * @param array $options Optional. Custom option $key => $value pairs to use. Default empty array.
  342. */
  343. function populate_options( array $options = array() ) {
  344. global $wpdb, $wp_db_version, $wp_current_db_version;
  345. $guessurl = wp_guess_url();
  346. /**
  347. * Fires before creating WordPress options and populating their default values.
  348. *
  349. * @since 2.6.0
  350. */
  351. do_action( 'populate_options' );
  352. // If WP_DEFAULT_THEME doesn't exist, fall back to the latest core default theme.
  353. $stylesheet = WP_DEFAULT_THEME;
  354. $template = WP_DEFAULT_THEME;
  355. $theme = wp_get_theme( WP_DEFAULT_THEME );
  356. if ( ! $theme->exists() ) {
  357. $theme = WP_Theme::get_core_default_theme();
  358. }
  359. // If we can't find a core default theme, WP_DEFAULT_THEME is the best we can do.
  360. if ( $theme ) {
  361. $stylesheet = $theme->get_stylesheet();
  362. $template = $theme->get_template();
  363. }
  364. $timezone_string = '';
  365. $gmt_offset = 0;
  366. /*
  367. * translators: default GMT offset or timezone string. Must be either a valid offset (-12 to 14)
  368. * or a valid timezone string (America/New_York). See https://www.php.net/manual/en/timezones.php
  369. * for all timezone strings supported by PHP.
  370. */
  371. $offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); // phpcs:ignore WordPress.WP.I18n.NoEmptyStrings
  372. if ( is_numeric( $offset_or_tz ) ) {
  373. $gmt_offset = $offset_or_tz;
  374. } elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list(), true ) ) {
  375. $timezone_string = $offset_or_tz;
  376. }
  377. $defaults = array(
  378. 'siteurl' => $guessurl,
  379. 'home' => $guessurl,
  380. 'blogname' => __( 'My Site' ),
  381. /* translators: Site tagline. */
  382. 'blogdescription' => __( 'Just another WordPress site' ),
  383. 'users_can_register' => 0,
  384. 'admin_email' => 'you@example.com',
  385. /* translators: Default start of the week. 0 = Sunday, 1 = Monday. */
  386. 'start_of_week' => _x( '1', 'start of week' ),
  387. 'use_balanceTags' => 0,
  388. 'use_smilies' => 1,
  389. 'require_name_email' => 1,
  390. 'comments_notify' => 1,
  391. 'posts_per_rss' => 10,
  392. 'rss_use_excerpt' => 0,
  393. 'mailserver_url' => 'mail.example.com',
  394. 'mailserver_login' => 'login@example.com',
  395. 'mailserver_pass' => 'password',
  396. 'mailserver_port' => 110,
  397. 'default_category' => 1,
  398. 'default_comment_status' => 'open',
  399. 'default_ping_status' => 'open',
  400. 'default_pingback_flag' => 1,
  401. 'posts_per_page' => 10,
  402. /* translators: Default date format, see https://www.php.net/manual/datetime.format.php */
  403. 'date_format' => __( 'F j, Y' ),
  404. /* translators: Default time format, see https://www.php.net/manual/datetime.format.php */
  405. 'time_format' => __( 'g:i a' ),
  406. /* translators: Links last updated date format, see https://www.php.net/manual/datetime.format.php */
  407. 'links_updated_date_format' => __( 'F j, Y g:i a' ),
  408. 'comment_moderation' => 0,
  409. 'moderation_notify' => 1,
  410. 'permalink_structure' => '',
  411. 'rewrite_rules' => '',
  412. 'hack_file' => 0,
  413. 'blog_charset' => 'UTF-8',
  414. 'moderation_keys' => '',
  415. 'active_plugins' => array(),
  416. 'category_base' => '',
  417. 'ping_sites' => 'http://rpc.pingomatic.com/',
  418. 'comment_max_links' => 2,
  419. 'gmt_offset' => $gmt_offset,
  420. // 1.5.0
  421. 'default_email_category' => 1,
  422. 'recently_edited' => '',
  423. 'template' => $template,
  424. 'stylesheet' => $stylesheet,
  425. 'comment_registration' => 0,
  426. 'html_type' => 'text/html',
  427. // 1.5.1
  428. 'use_trackback' => 0,
  429. // 2.0.0
  430. 'default_role' => 'subscriber',
  431. 'db_version' => $wp_db_version,
  432. // 2.0.1
  433. 'uploads_use_yearmonth_folders' => 1,
  434. 'upload_path' => '',
  435. // 2.1.0
  436. 'blog_public' => '1',
  437. 'default_link_category' => 2,
  438. 'show_on_front' => 'posts',
  439. // 2.2.0
  440. 'tag_base' => '',
  441. // 2.5.0
  442. 'show_avatars' => '1',
  443. 'avatar_rating' => 'G',
  444. 'upload_url_path' => '',
  445. 'thumbnail_size_w' => 150,
  446. 'thumbnail_size_h' => 150,
  447. 'thumbnail_crop' => 1,
  448. 'medium_size_w' => 300,
  449. 'medium_size_h' => 300,
  450. // 2.6.0
  451. 'avatar_default' => 'mystery',
  452. // 2.7.0
  453. 'large_size_w' => 1024,
  454. 'large_size_h' => 1024,
  455. 'image_default_link_type' => 'none',
  456. 'image_default_size' => '',
  457. 'image_default_align' => '',
  458. 'close_comments_for_old_posts' => 0,
  459. 'close_comments_days_old' => 14,
  460. 'thread_comments' => 1,
  461. 'thread_comments_depth' => 5,
  462. 'page_comments' => 0,
  463. 'comments_per_page' => 50,
  464. 'default_comments_page' => 'newest',
  465. 'comment_order' => 'asc',
  466. 'sticky_posts' => array(),
  467. 'widget_categories' => array(),
  468. 'widget_text' => array(),
  469. 'widget_rss' => array(),
  470. 'uninstall_plugins' => array(),
  471. // 2.8.0
  472. 'timezone_string' => $timezone_string,
  473. // 3.0.0
  474. 'page_for_posts' => 0,
  475. 'page_on_front' => 0,
  476. // 3.1.0
  477. 'default_post_format' => 0,
  478. // 3.5.0
  479. 'link_manager_enabled' => 0,
  480. // 4.3.0
  481. 'finished_splitting_shared_terms' => 1,
  482. 'site_icon' => 0,
  483. // 4.4.0
  484. 'medium_large_size_w' => 768,
  485. 'medium_large_size_h' => 0,
  486. // 4.9.6
  487. 'wp_page_for_privacy_policy' => 0,
  488. // 4.9.8
  489. 'show_comments_cookies_opt_in' => 1,
  490. // 5.3.0
  491. 'admin_email_lifespan' => ( time() + 6 * MONTH_IN_SECONDS ),
  492. // 5.5.0
  493. 'disallowed_keys' => '',
  494. 'comment_previously_approved' => 1,
  495. 'auto_plugin_theme_update_emails' => array(),
  496. // 5.6.0
  497. 'auto_update_core_dev' => 'enabled',
  498. 'auto_update_core_minor' => 'enabled',
  499. // Default to enabled for new installs.
  500. // See https://core.trac.wordpress.org/ticket/51742.
  501. 'auto_update_core_major' => 'enabled',
  502. // 5.8.0
  503. 'wp_force_deactivated_plugins' => array(),
  504. );
  505. // 3.3.0
  506. if ( ! is_multisite() ) {
  507. $defaults['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version
  508. ? $wp_current_db_version : $wp_db_version;
  509. }
  510. // 3.0.0 multisite.
  511. if ( is_multisite() ) {
  512. /* translators: %s: Network title. */
  513. $defaults['blogdescription'] = sprintf( __( 'Just another %s site' ), get_network()->site_name );
  514. $defaults['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/';
  515. }
  516. $options = wp_parse_args( $options, $defaults );
  517. // Set autoload to no for these options.
  518. $fat_options = array(
  519. 'moderation_keys',
  520. 'recently_edited',
  521. 'disallowed_keys',
  522. 'uninstall_plugins',
  523. 'auto_plugin_theme_update_emails',
  524. );
  525. $keys = "'" . implode( "', '", array_keys( $options ) ) . "'";
  526. $existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
  527. $insert = '';
  528. foreach ( $options as $option => $value ) {
  529. if ( in_array( $option, $existing_options, true ) ) {
  530. continue;
  531. }
  532. if ( in_array( $option, $fat_options, true ) ) {
  533. $autoload = 'no';
  534. } else {
  535. $autoload = 'yes';
  536. }
  537. if ( is_array( $value ) ) {
  538. $value = serialize( $value );
  539. }
  540. if ( ! empty( $insert ) ) {
  541. $insert .= ', ';
  542. }
  543. $insert .= $wpdb->prepare( '(%s, %s, %s)', $option, $value, $autoload );
  544. }
  545. if ( ! empty( $insert ) ) {
  546. $wpdb->query( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
  547. }
  548. // In case it is set, but blank, update "home".
  549. if ( ! __get_option( 'home' ) ) {
  550. update_option( 'home', $guessurl );
  551. }
  552. // Delete unused options.
  553. $unusedoptions = array(
  554. 'blodotgsping_url',
  555. 'bodyterminator',
  556. 'emailtestonly',
  557. 'phoneemail_separator',
  558. 'smilies_directory',
  559. 'subjectprefix',
  560. 'use_bbcode',
  561. 'use_blodotgsping',
  562. 'use_phoneemail',
  563. 'use_quicktags',
  564. 'use_weblogsping',
  565. 'weblogs_cache_file',
  566. 'use_preview',
  567. 'use_htmltrans',
  568. 'smilies_directory',
  569. 'fileupload_allowedusers',
  570. 'use_phoneemail',
  571. 'default_post_status',
  572. 'default_post_category',
  573. 'archive_mode',
  574. 'time_difference',
  575. 'links_minadminlevel',
  576. 'links_use_adminlevels',
  577. 'links_rating_type',
  578. 'links_rating_char',
  579. 'links_rating_ignore_zero',
  580. 'links_rating_single_image',
  581. 'links_rating_image0',
  582. 'links_rating_image1',
  583. 'links_rating_image2',
  584. 'links_rating_image3',
  585. 'links_rating_image4',
  586. 'links_rating_image5',
  587. 'links_rating_image6',
  588. 'links_rating_image7',
  589. 'links_rating_image8',
  590. 'links_rating_image9',
  591. 'links_recently_updated_time',
  592. 'links_recently_updated_prepend',
  593. 'links_recently_updated_append',
  594. 'weblogs_cacheminutes',
  595. 'comment_allowed_tags',
  596. 'search_engine_friendly_urls',
  597. 'default_geourl_lat',
  598. 'default_geourl_lon',
  599. 'use_default_geourl',
  600. 'weblogs_xml_url',
  601. 'new_users_can_blog',
  602. '_wpnonce',
  603. '_wp_http_referer',
  604. 'Update',
  605. 'action',
  606. 'rich_editing',
  607. 'autosave_interval',
  608. 'deactivated_plugins',
  609. 'can_compress_scripts',
  610. 'page_uris',
  611. 'update_core',
  612. 'update_plugins',
  613. 'update_themes',
  614. 'doing_cron',
  615. 'random_seed',
  616. 'rss_excerpt_length',
  617. 'secret',
  618. 'use_linksupdate',
  619. 'default_comment_status_page',
  620. 'wporg_popular_tags',
  621. 'what_to_show',
  622. 'rss_language',
  623. 'language',
  624. 'enable_xmlrpc',
  625. 'enable_app',
  626. 'embed_autourls',
  627. 'default_post_edit_rows',
  628. 'gzipcompression',
  629. 'advanced_edit',
  630. );
  631. foreach ( $unusedoptions as $option ) {
  632. delete_option( $option );
  633. }
  634. // Delete obsolete magpie stuff.
  635. $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'" );
  636. // Clear expired transients.
  637. delete_expired_transients( true );
  638. }
  639. /**
  640. * Execute WordPress role creation for the various WordPress versions.
  641. *
  642. * @since 2.0.0
  643. */
  644. function populate_roles() {
  645. populate_roles_160();
  646. populate_roles_210();
  647. populate_roles_230();
  648. populate_roles_250();
  649. populate_roles_260();
  650. populate_roles_270();
  651. populate_roles_280();
  652. populate_roles_300();
  653. }
  654. /**
  655. * Create the roles for WordPress 2.0
  656. *
  657. * @since 2.0.0
  658. */
  659. function populate_roles_160() {
  660. // Add roles.
  661. add_role( 'administrator', 'Administrator' );
  662. add_role( 'editor', 'Editor' );
  663. add_role( 'author', 'Author' );
  664. add_role( 'contributor', 'Contributor' );
  665. add_role( 'subscriber', 'Subscriber' );
  666. // Add caps for Administrator role.
  667. $role = get_role( 'administrator' );
  668. $role->add_cap( 'switch_themes' );
  669. $role->add_cap( 'edit_themes' );
  670. $role->add_cap( 'activate_plugins' );
  671. $role->add_cap( 'edit_plugins' );
  672. $role->add_cap( 'edit_users' );
  673. $role->add_cap( 'edit_files' );
  674. $role->add_cap( 'manage_options' );
  675. $role->add_cap( 'moderate_comments' );
  676. $role->add_cap( 'manage_categories' );
  677. $role->add_cap( 'manage_links' );
  678. $role->add_cap( 'upload_files' );
  679. $role->add_cap( 'import' );
  680. $role->add_cap( 'unfiltered_html' );
  681. $role->add_cap( 'edit_posts' );
  682. $role->add_cap( 'edit_others_posts' );
  683. $role->add_cap( 'edit_published_posts' );
  684. $role->add_cap( 'publish_posts' );
  685. $role->add_cap( 'edit_pages' );
  686. $role->add_cap( 'read' );
  687. $role->add_cap( 'level_10' );
  688. $role->add_cap( 'level_9' );
  689. $role->add_cap( 'level_8' );
  690. $role->add_cap( 'level_7' );
  691. $role->add_cap( 'level_6' );
  692. $role->add_cap( 'level_5' );
  693. $role->add_cap( 'level_4' );
  694. $role->add_cap( 'level_3' );
  695. $role->add_cap( 'level_2' );
  696. $role->add_cap( 'level_1' );
  697. $role->add_cap( 'level_0' );
  698. // Add caps for Editor role.
  699. $role = get_role( 'editor' );
  700. $role->add_cap( 'moderate_comments' );
  701. $role->add_cap( 'manage_categories' );
  702. $role->add_cap( 'manage_links' );
  703. $role->add_cap( 'upload_files' );
  704. $role->add_cap( 'unfiltered_html' );
  705. $role->add_cap( 'edit_posts' );
  706. $role->add_cap( 'edit_others_posts' );
  707. $role->add_cap( 'edit_published_posts' );
  708. $role->add_cap( 'publish_posts' );
  709. $role->add_cap( 'edit_pages' );
  710. $role->add_cap( 'read' );
  711. $role->add_cap( 'level_7' );
  712. $role->add_cap( 'level_6' );
  713. $role->add_cap( 'level_5' );
  714. $role->add_cap( 'level_4' );
  715. $role->add_cap( 'level_3' );
  716. $role->add_cap( 'level_2' );
  717. $role->add_cap( 'level_1' );
  718. $role->add_cap( 'level_0' );
  719. // Add caps for Author role.
  720. $role = get_role( 'author' );
  721. $role->add_cap( 'upload_files' );
  722. $role->add_cap( 'edit_posts' );
  723. $role->add_cap( 'edit_published_posts' );
  724. $role->add_cap( 'publish_posts' );
  725. $role->add_cap( 'read' );
  726. $role->add_cap( 'level_2' );
  727. $role->add_cap( 'level_1' );
  728. $role->add_cap( 'level_0' );
  729. // Add caps for Contributor role.
  730. $role = get_role( 'contributor' );
  731. $role->add_cap( 'edit_posts' );
  732. $role->add_cap( 'read' );
  733. $role->add_cap( 'level_1' );
  734. $role->add_cap( 'level_0' );
  735. // Add caps for Subscriber role.
  736. $role = get_role( 'subscriber' );
  737. $role->add_cap( 'read' );
  738. $role->add_cap( 'level_0' );
  739. }
  740. /**
  741. * Create and modify WordPress roles for WordPress 2.1.
  742. *
  743. * @since 2.1.0
  744. */
  745. function populate_roles_210() {
  746. $roles = array( 'administrator', 'editor' );
  747. foreach ( $roles as $role ) {
  748. $role = get_role( $role );
  749. if ( empty( $role ) ) {
  750. continue;
  751. }
  752. $role->add_cap( 'edit_others_pages' );
  753. $role->add_cap( 'edit_published_pages' );
  754. $role->add_cap( 'publish_pages' );
  755. $role->add_cap( 'delete_pages' );
  756. $role->add_cap( 'delete_others_pages' );
  757. $role->add_cap( 'delete_published_pages' );
  758. $role->add_cap( 'delete_posts' );
  759. $role->add_cap( 'delete_others_posts' );
  760. $role->add_cap( 'delete_published_posts' );
  761. $role->add_cap( 'delete_private_posts' );
  762. $role->add_cap( 'edit_private_posts' );
  763. $role->add_cap( 'read_private_posts' );
  764. $role->add_cap( 'delete_private_pages' );
  765. $role->add_cap( 'edit_private_pages' );
  766. $role->add_cap( 'read_private_pages' );
  767. }
  768. $role = get_role( 'administrator' );
  769. if ( ! empty( $role ) ) {
  770. $role->add_cap( 'delete_users' );
  771. $role->add_cap( 'create_users' );
  772. }
  773. $role = get_role( 'author' );
  774. if ( ! empty( $role ) ) {
  775. $role->add_cap( 'delete_posts' );
  776. $role->add_cap( 'delete_published_posts' );
  777. }
  778. $role = get_role( 'contributor' );
  779. if ( ! empty( $role ) ) {
  780. $role->add_cap( 'delete_posts' );
  781. }
  782. }
  783. /**
  784. * Create and modify WordPress roles for WordPress 2.3.
  785. *
  786. * @since 2.3.0
  787. */
  788. function populate_roles_230() {
  789. $role = get_role( 'administrator' );
  790. if ( ! empty( $role ) ) {
  791. $role->add_cap( 'unfiltered_upload' );
  792. }
  793. }
  794. /**
  795. * Create and modify WordPress roles for WordPress 2.5.
  796. *
  797. * @since 2.5.0
  798. */
  799. function populate_roles_250() {
  800. $role = get_role( 'administrator' );
  801. if ( ! empty( $role ) ) {
  802. $role->add_cap( 'edit_dashboard' );
  803. }
  804. }
  805. /**
  806. * Create and modify WordPress roles for WordPress 2.6.
  807. *
  808. * @since 2.6.0
  809. */
  810. function populate_roles_260() {
  811. $role = get_role( 'administrator' );
  812. if ( ! empty( $role ) ) {
  813. $role->add_cap( 'update_plugins' );
  814. $role->add_cap( 'delete_plugins' );
  815. }
  816. }
  817. /**
  818. * Create and modify WordPress roles for WordPress 2.7.
  819. *
  820. * @since 2.7.0
  821. */
  822. function populate_roles_270() {
  823. $role = get_role( 'administrator' );
  824. if ( ! empty( $role ) ) {
  825. $role->add_cap( 'install_plugins' );
  826. $role->add_cap( 'update_themes' );
  827. }
  828. }
  829. /**
  830. * Create and modify WordPress roles for WordPress 2.8.
  831. *
  832. * @since 2.8.0
  833. */
  834. function populate_roles_280() {
  835. $role = get_role( 'administrator' );
  836. if ( ! empty( $role ) ) {
  837. $role->add_cap( 'install_themes' );
  838. }
  839. }
  840. /**
  841. * Create and modify WordPress roles for WordPress 3.0.
  842. *
  843. * @since 3.0.0
  844. */
  845. function populate_roles_300() {
  846. $role = get_role( 'administrator' );
  847. if ( ! empty( $role ) ) {
  848. $role->add_cap( 'update_core' );
  849. $role->add_cap( 'list_users' );
  850. $role->add_cap( 'remove_users' );
  851. $role->add_cap( 'promote_users' );
  852. $role->add_cap( 'edit_theme_options' );
  853. $role->add_cap( 'delete_themes' );
  854. $role->add_cap( 'export' );
  855. }
  856. }
  857. if ( ! function_exists( 'install_network' ) ) :
  858. /**
  859. * Install Network.
  860. *
  861. * @since 3.0.0
  862. */
  863. function install_network() {
  864. if ( ! defined( 'WP_INSTALLING_NETWORK' ) ) {
  865. define( 'WP_INSTALLING_NETWORK', true );
  866. }
  867. dbDelta( wp_get_db_schema( 'global' ) );
  868. }
  869. endif;
  870. /**
  871. * Populate network settings.
  872. *
  873. * @since 3.0.0
  874. *
  875. * @global wpdb $wpdb WordPress database abstraction object.
  876. * @global object $current_site
  877. * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
  878. *
  879. * @param int $network_id ID of network to populate.
  880. * @param string $domain The domain name for the network (eg. "example.com").
  881. * @param string $email Email address for the network administrator.
  882. * @param string $site_name The name of the network.
  883. * @param string $path Optional. The path to append to the network's domain name. Default '/'.
  884. * @param bool $subdomain_install Optional. Whether the network is a subdomain installation or a subdirectory installation.
  885. * Default false, meaning the network is a subdirectory installation.
  886. * @return bool|WP_Error True on success, or WP_Error on warning (with the installation otherwise successful,
  887. * so the error code must be checked) or failure.
  888. */
  889. function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) {
  890. global $wpdb, $current_site, $wp_rewrite;
  891. $errors = new WP_Error();
  892. if ( '' === $domain ) {
  893. $errors->add( 'empty_domain', __( 'You must provide a domain name.' ) );
  894. }
  895. if ( '' === $site_name ) {
  896. $errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) );
  897. }
  898. // Check for network collision.
  899. $network_exists = false;
  900. if ( is_multisite() ) {
  901. if ( get_network( (int) $network_id ) ) {
  902. $errors->add( 'siteid_exists', __( 'The network already exists.' ) );
  903. }
  904. } else {
  905. if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) {
  906. $errors->add( 'siteid_exists', __( 'The network already exists.' ) );
  907. }
  908. }
  909. if ( ! is_email( $email ) ) {
  910. $errors->add( 'invalid_email', __( 'You must provide a valid email address.' ) );
  911. }
  912. if ( $errors->has_errors() ) {
  913. return $errors;
  914. }
  915. if ( 1 == $network_id ) {
  916. $wpdb->insert(
  917. $wpdb->site,
  918. array(
  919. 'domain' => $domain,
  920. 'path' => $path,
  921. )
  922. );
  923. $network_id = $wpdb->insert_id;
  924. } else {
  925. $wpdb->insert(
  926. $wpdb->site,
  927. array(
  928. 'domain' => $domain,
  929. 'path' => $path,
  930. 'id' => $network_id,
  931. )
  932. );
  933. }
  934. populate_network_meta(
  935. $network_id,
  936. array(
  937. 'admin_email' => $email,
  938. 'site_name' => $site_name,
  939. 'subdomain_install' => $subdomain_install,
  940. )
  941. );
  942. $site_user = get_userdata( (int) $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", 'admin_user_id', $network_id ) ) );
  943. /*
  944. * When upgrading from single to multisite, assume the current site will
  945. * become the main site of the network. When using populate_network()
  946. * to create another network in an existing multisite environment, skip
  947. * these steps since the main site of the new network has not yet been
  948. * created.
  949. */
  950. if ( ! is_multisite() ) {
  951. $current_site = new stdClass;
  952. $current_site->domain = $domain;
  953. $current_site->path = $path;
  954. $current_site->site_name = ucfirst( $domain );
  955. $wpdb->insert(
  956. $wpdb->blogs,
  957. array(
  958. 'site_id' => $network_id,
  959. 'blog_id' => 1,
  960. 'domain' => $domain,
  961. 'path' => $path,
  962. 'registered' => current_time( 'mysql' ),
  963. )
  964. );
  965. $current_site->blog_id = $wpdb->insert_id;
  966. update_user_meta( $site_user->ID, 'source_domain', $domain );
  967. update_user_meta( $site_user->ID, 'primary_blog', $current_site->blog_id );
  968. if ( $subdomain_install ) {
  969. $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
  970. } else {
  971. $wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' );
  972. }
  973. flush_rewrite_rules();
  974. if ( ! $subdomain_install ) {
  975. return true;
  976. }
  977. $vhost_ok = false;
  978. $errstr = '';
  979. $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname!
  980. $page = wp_remote_get(
  981. 'http://' . $hostname,
  982. array(
  983. 'timeout' => 5,
  984. 'httpversion' => '1.1',
  985. )
  986. );
  987. if ( is_wp_error( $page ) ) {
  988. $errstr = $page->get_error_message();
  989. } elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) {
  990. $vhost_ok = true;
  991. }
  992. if ( ! $vhost_ok ) {
  993. $msg = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>';
  994. $msg .= '<p>' . sprintf(
  995. /* translators: %s: Host name. */
  996. __( 'The installer attempted to contact a random hostname (%s) on your domain.' ),
  997. '<code>' . $hostname . '</code>'
  998. );
  999. if ( ! empty( $errstr ) ) {
  1000. /* translators: %s: Error message. */
  1001. $msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' );
  1002. }
  1003. $msg .= '</p>';
  1004. $msg .= '<p>' . sprintf(
  1005. /* translators: %s: Asterisk symbol (*). */
  1006. __( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a %s hostname record pointing at your web server in your DNS configuration tool.' ),
  1007. '<code>*</code>'
  1008. ) . '</p>';
  1009. $msg .= '<p>' . __( 'You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.' ) . '</p>';
  1010. return new WP_Error( 'no_wildcard_dns', $msg );
  1011. }
  1012. }
  1013. return true;
  1014. }
  1015. /**
  1016. * Creates WordPress network meta and sets the default values.
  1017. *
  1018. * @since 5.1.0
  1019. *
  1020. * @global wpdb $wpdb WordPress database abstraction object.
  1021. * @global int $wp_db_version WordPress database version.
  1022. *
  1023. * @param int $network_id Network ID to populate meta for.
  1024. * @param array $meta Optional. Custom meta $key => $value pairs to use. Default empty array.
  1025. */
  1026. function populate_network_meta( $network_id, array $meta = array() ) {
  1027. global $wpdb, $wp_db_version;
  1028. $network_id = (int) $network_id;
  1029. $email = ! empty( $meta['admin_email'] ) ? $meta['admin_email'] : '';
  1030. $subdomain_install = isset( $meta['subdomain_install'] ) ? (int) $meta['subdomain_install'] : 0;
  1031. // If a user with the provided email does not exist, default to the current user as the new network admin.
  1032. $site_user = ! empty( $email ) ? get_user_by( 'email', $email ) : false;
  1033. if ( false === $site_user ) {
  1034. $site_user = wp_get_current_user();
  1035. }
  1036. if ( empty( $email ) ) {
  1037. $email = $site_user->user_email;
  1038. }
  1039. $template = get_option( 'template' );
  1040. $stylesheet = get_option( 'stylesheet' );
  1041. $allowed_themes = array( $stylesheet => true );
  1042. if ( $template != $stylesheet ) {
  1043. $allowed_themes[ $template ] = true;
  1044. }
  1045. if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template ) {
  1046. $allowed_themes[ WP_DEFAULT_THEME ] = true;
  1047. }
  1048. // If WP_DEFAULT_THEME doesn't exist, also include the latest core default theme.
  1049. if ( ! wp_get_theme( WP_DEFAULT_THEME )->exists() ) {
  1050. $core_default = WP_Theme::get_core_default_theme();
  1051. if ( $core_default ) {
  1052. $allowed_themes[ $core_default->get_stylesheet() ] = true;
  1053. }
  1054. }
  1055. if ( function_exists( 'clean_network_cache' ) ) {
  1056. clean_network_cache( $network_id );
  1057. } else {
  1058. wp_cache_delete( $network_id, 'networks' );
  1059. }
  1060. wp_cache_delete( 'networks_have_paths', 'site-options' );
  1061. if ( ! is_multisite() ) {
  1062. $site_admins = array( $site_user->user_login );
  1063. $users = get_users(
  1064. array(
  1065. 'fields' => array( 'user_login' ),
  1066. 'role' => 'administrator',
  1067. )
  1068. );
  1069. if ( $users ) {
  1070. foreach ( $users as $user ) {
  1071. $site_admins[] = $user->user_login;
  1072. }
  1073. $site_admins = array_unique( $site_admins );
  1074. }
  1075. } else {
  1076. $site_admins = get_site_option( 'site_admins' );
  1077. }
  1078. /* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */
  1079. $welcome_email = __(
  1080. 'Howdy USERNAME,
  1081. Your new SITE_NAME site has been successfully set up at:
  1082. BLOG_URL
  1083. You can log in to the administrator account with the following information:
  1084. Username: USERNAME
  1085. Password: PASSWORD
  1086. Log in here: BLOG_URLwp-login.php
  1087. We hope you enjoy your new site. Thanks!
  1088. --The Team @ SITE_NAME'
  1089. );
  1090. $misc_exts = array(
  1091. // Images.
  1092. 'jpg',
  1093. 'jpeg',
  1094. 'png',
  1095. 'gif',
  1096. 'webp',
  1097. // Video.
  1098. 'mov',
  1099. 'avi',
  1100. 'mpg',
  1101. '3gp',
  1102. '3g2',
  1103. // "audio".
  1104. 'midi',
  1105. 'mid',
  1106. // Miscellaneous.
  1107. 'pdf',
  1108. 'doc',
  1109. 'ppt',
  1110. 'odt',
  1111. 'pptx',
  1112. 'docx',
  1113. 'pps',
  1114. 'ppsx',
  1115. 'xls',
  1116. 'xlsx',
  1117. 'key',
  1118. );
  1119. $audio_exts = wp_get_audio_extensions();
  1120. $video_exts = wp_get_video_extensions();
  1121. $upload_filetypes = array_unique( array_merge( $misc_exts, $audio_exts, $video_exts ) );
  1122. $sitemeta = array(
  1123. 'site_name' => __( 'My Network' ),
  1124. 'admin_email' => $email,
  1125. 'admin_user_id' => $site_user->ID,
  1126. 'registration' => 'none',
  1127. 'upload_filetypes' => implode( ' ', $upload_filetypes ),
  1128. 'blog_upload_space' => 100,
  1129. 'fileupload_maxk' => 1500,
  1130. 'site_admins' => $site_admins,
  1131. 'allowedthemes' => $allowed_themes,
  1132. 'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ),
  1133. 'wpmu_upgrade_site' => $wp_db_version,
  1134. 'welcome_email' => $welcome_email,
  1135. /* translators: %s: Site link. */
  1136. 'first_post' => __( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ),
  1137. // @todo - Network admins should have a method of editing the network siteurl (used for cookie hash).
  1138. 'siteurl' => get_option( 'siteurl' ) . '/',
  1139. 'add_new_users' => '0',
  1140. 'upload_space_check_disabled' => is_multisite() ? get_site_option( 'upload_space_check_disabled' ) : '1',
  1141. 'subdomain_install' => $subdomain_install,
  1142. 'global_terms_enabled' => global_terms_enabled() ? '1' : '0',
  1143. 'ms_files_rewriting' => is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0',
  1144. 'initial_db_version' => get_option( 'initial_db_version' ),
  1145. 'active_sitewide_plugins' => array(),
  1146. 'WPLANG' => get_locale(),
  1147. );
  1148. if ( ! $subdomain_install ) {
  1149. $sitemeta['illegal_names'][] = 'blog';
  1150. }
  1151. $sitemeta = wp_parse_args( $meta, $sitemeta );
  1152. /**
  1153. * Filters meta for a network on creation.
  1154. *
  1155. * @since 3.7.0
  1156. *
  1157. * @param array $sitemeta Associative array of network meta keys and values to be inserted.
  1158. * @param int $network_id ID of network to populate.
  1159. */
  1160. $sitemeta = apply_filters( 'populate_network_meta', $sitemeta, $network_id );
  1161. $insert = '';
  1162. foreach ( $sitemeta as $meta_key => $meta_value ) {
  1163. if ( is_array( $meta_value ) ) {
  1164. $meta_value = serialize( $meta_value );
  1165. }
  1166. if ( ! empty( $insert ) ) {
  1167. $insert .= ', ';
  1168. }
  1169. $insert .= $wpdb->prepare( '( %d, %s, %s)', $network_id, $meta_key, $meta_value );
  1170. }
  1171. $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
  1172. }
  1173. /**
  1174. * Creates WordPress site meta and sets the default values.
  1175. *
  1176. * @since 5.1.0
  1177. *
  1178. * @global wpdb $wpdb WordPress database abstraction object.
  1179. *
  1180. * @param int $site_id Site ID to populate meta for.
  1181. * @param array $meta Optional. Custom meta $key => $value pairs to use. Default empty array.
  1182. */
  1183. function populate_site_meta( $site_id, array $meta = array() ) {
  1184. global $wpdb;
  1185. $site_id = (int) $site_id;
  1186. if ( ! is_site_meta_supported() ) {
  1187. return;
  1188. }
  1189. if ( empty( $meta ) ) {
  1190. return;
  1191. }
  1192. /**
  1193. * Filters meta for a site on creation.
  1194. *
  1195. * @since 5.2.0
  1196. *
  1197. * @param array $meta Associative array of site meta keys and values to be inserted.
  1198. * @param int $site_id ID of site to populate.
  1199. */
  1200. $site_meta = apply_filters( 'populate_site_meta', $meta, $site_id );
  1201. $insert = '';
  1202. foreach ( $site_meta as $meta_key => $meta_value ) {
  1203. if ( is_array( $meta_value ) ) {
  1204. $meta_value = serialize( $meta_value );
  1205. }
  1206. if ( ! empty( $insert ) ) {
  1207. $insert .= ', ';
  1208. }
  1209. $insert .= $wpdb->prepare( '( %d, %s, %s)', $site_id, $meta_key, $meta_value );
  1210. }
  1211. $wpdb->query( "INSERT INTO $wpdb->blogmeta ( blog_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
  1212. wp_cache_delete( $site_id, 'blog_meta' );
  1213. wp_cache_set_sites_last_changed();
  1214. }