### Install Chromium on Linux (RPM) Source: https://www.skycaiji.com/manual/doc/page_render Installs Chromium by downloading an RPM package. This method is an alternative if direct dnf installation is not feasible. ```bash 下载安装包:https://pkgs.org/download/chromium yum localinstall ./chromium-[刚下载的rpm版本号].rpm 安装后的路径为:/usr/bin/chromium-browser ``` -------------------------------- ### Install Chromium on Linux (dnf) Source: https://www.skycaiji.com/manual/doc/page_render Installs Chromium using the dnf package manager. Ensure Chromium is installed before enabling page rendering. ```bash sudo yum install dnf -y sudo dnf install chromium 安装后的路径为:/usr/bin/chromium-browser ``` -------------------------------- ### GET Mode Configuration for One-Click Import Source: https://www.skycaiji.com/manual/doc/toapi_app Used for reading configuration. This GET mode requires a JSON response detailing the import settings. Ensure the 'response' array keys match the expected fields for ID, target, description, and error. ```php exit(json_encode(array( // Request method: post or get 'type' => '', // Page encoding 'charset' => '', // When type is post, data type: default form data, JSON array, form upload 'content_type' => '', // Bind response JSON array key names 'response' => array( 'id' => 'id', 'target' => 'target', 'desc' => 'desc', 'error' => 'error', ), // Configuration options 'params' => array( // Option parameters array( 'name' => '', // Name 'required' => 0, // Required: 0 or 1 'tag' => '', // Tag type: text, number, select, checkbox, radio 'option' => array(), // Options (key-value pairs), valid for select, checkbox, radio 'default' => '', // Default value, use array for multiple ), // ... can add multiple option parameters ), ))); ``` -------------------------------- ### Return Application Status for Install/Uninstall/Upgrade Source: https://www.skycaiji.com/manual/doc/app If your application provides installation, uninstallation, or upgrade interfaces, use `skycaiji_app()->status()` to return the current status. ```php skycaiji_app()->status() ``` -------------------------------- ### Install Chrome on CentOS 7 Source: https://www.skycaiji.com/manual/doc/page_render Installs Google Chrome Stable on CentOS 7 using a downloaded RPM package. This is required for Chrome-specific rendering features. ```bash wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm yum localinstall google-chrome-stable_current_x86_64.rpm 安装后的路径为:/usr/bin/google-chrome ``` -------------------------------- ### Get User List for Author Account Source: https://www.skycaiji.com/manual/doc/cms Retrieves a list of users from the database to populate the author account selection. Ensure the database connection is active. ```php public function param_option_author(){ $usersDb=$this->db()->table('__USERS__')->limit(100)->select(); $userList=array(); foreach ($usersDb as $user){ $userList[$user['user_login']]=$user['user_login']; } return $userList; } ``` -------------------------------- ### Get SkyCaiji Application Object Source: https://www.skycaiji.com/manual/doc/app Use the `skycaiji_app()` method within your application code to obtain the application class object for interacting with SkyCaiji. ```php skycaiji_app() ``` -------------------------------- ### POST Mode Data Input for One-Click Import Source: https://www.skycaiji.com/manual/doc/toapi_app Used for storing data. This POST mode requires a JSON response that maps to the key names defined in the GET mode's 'response' configuration. ```php exit(json_encode($array)); // $array must be in key-value format, bound by key names in 'GET Mode' ``` -------------------------------- ### Get Category List for Category Selection Source: https://www.skycaiji.com/manual/doc/cms Fetches a list of categories from the database to populate the category selection. This function assumes a 'terms' table with 'term_id' and 'name' columns. ```php public function param_option_category(){ $catsDb=$this->db()->table('__TERMS__')->select(); $catList=array(); foreach ($catsDb as $cat){ $catList[$cat['term_id']]=$cat['name']; } return $catList; } ``` -------------------------------- ### Access SkyCaiji System Configuration Source: https://www.skycaiji.com/manual/doc/app Access the `system` property via `skycaiji_app()->system` to retrieve SkyCaiji configurations, including database settings. ```php skycaiji_app()->system ``` -------------------------------- ### Custom CMS Database Configuration Source: https://www.skycaiji.com/manual/doc/cms Provides a method to manually configure database connection details for a specific CMS if automatic detection fails. The CMS name must match the plugin's CMS program name. ```php //CMS全称必须与你插件的cms程序名一致,$cmsPath为cms的根目录路径 public function cms_db__**CMS全称**_($cmsPath){ //请读取cms的配置文件并将数据库保存为以下数组形式后返回,可参考BaseCms.php中的其它cms_db_方法 $cmsDb=array( 'db_type' => 'mysql', 'db_user' => '', 'db_pwd' => '', 'db_host' => '', 'db_port' => 3306, 'db_name' => '', 'db_charset' => 'utf8', 'db_prefix' => '', ); return $cmsDb; } ``` -------------------------------- ### Data API Endpoint with Multiple Parameters Source: https://www.skycaiji.com/manual/doc/dataapi Access a data API endpoint with multiple query parameters. 'c5444' and 'c9ee8' represent specific data fields, and '%字符串%' is a placeholder for string values using wildcard matching. ```http http://localhost/skycaiji/index.php?s=/api/data/2**&c5444=%字符串%&c9ee8=%字符串%** ``` -------------------------------- ### Data API Endpoint with Single Parameter Source: https://www.skycaiji.com/manual/doc/dataapi Access a data API endpoint with a single query parameter. 'c9ee8' represents a specific data field, and '%字符串%' is a placeholder for string values using wildcard matching. ```http http://localhost/skycaiji/index.php?s=/api/data/2**&c9ee8=%字符串%** ``` -------------------------------- ### Return Response Status for Data Publishing Source: https://www.skycaiji.com/manual/doc/toapi_app After data is sent to a remote interface and stored, the collector needs a response status. Insert this code at the end of your interface code or after data is stored. The array must be key-value pairs, and the key names are bound in the 'Response Status' section of the interface call. ```php exit(json_encode($array)); // $array must be in key-value format ``` -------------------------------- ### Data Import Logic for CMS Plugins Source: https://www.skycaiji.com/manual/doc/cms The core function for importing data into the CMS. It receives parameters, processes them, and must return an array indicating the import status, target, and any errors. ```php /* * 导入数据 * 必须以数组形式返回: * id(必填)表示入库返回的自增id或状态 * target(可选)记录入库的数据位置(发布的网址等) * desc(可选)记录入库的数据位置附加信息 * error(可选)记录入库失败的错误信息 * 入库的信息可在“已采集数据”中查看 * return array('id'=>0,'target'=>'','desc'=>'','error'=>''); */ public function runImport($params){ print_r($params);die(); return array('id'=>0,'target'=>'','desc'=>'','error'=>''); } ``` -------------------------------- ### Check SkyCaiji Admin Login Status Source: https://www.skycaiji.com/manual/doc/app Use `skycaiji_app()->isAdmin()` to determine if the current user is an administrator logged into the SkyCaiji collector. ```php skycaiji_app()->isAdmin() ``` -------------------------------- ### Basic Data API Endpoint Source: https://www.skycaiji.com/manual/doc/dataapi This is the basic structure for accessing a data API endpoint. Replace '2' with your specific API ID. ```http http://localhost/skycaiji/index.php?s=/api/data/2** ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.