Server IP : 103.119.228.120 / Your IP : 3.137.169.14 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/softaculous/sitepad/editor/site-data/plugins/pagelayer-pro/lib/pquery/ |
Upload File : |
<?php /** * @author Niels A.D. * @author Todd Burry <todd@vanillaforums.com> * @copyright 2010 Niels A.D., 2014 Todd Burry * @license http://opensource.org/licenses/LGPL-2.1 LGPL-2.1 * @package pQuery */ use pagelayerQuery\IQuery; /** * A jQuery-like object for php. */ class pagelayerQuery implements ArrayAccess, IteratorAggregate, IQuery { /// Properties /// /** * @var IQuery[] */ protected $nodes = array(); /// Methods /// public function __construct($nodes = array()) { $this->nodes = $nodes; } public function addClass($classname) { foreach ($this->nodes as $node) { $node->addClass($classname); } return $this; } public function after($content) { foreach ($this->nodes as $node) { $node->after($content); } return $this; } public function append($content) { foreach ($this->nodes as $node) { $node->append($content); } return $this; } public function attr($name, $value = null) { if (empty($this->nodes) && $value === null) return ''; foreach ($this->nodes as $node) { if ($value === null) return $node->attr($name); $value = str_replace('<', '<', $value); $value = str_replace('>', '>', $value); $node->attr($name, $value); } return $this; } public function before($content) { foreach ($this->nodes as $node) { $node->before($content); } return $this; } public function clear() { foreach ($this->nodes as $node) { $node->clear(); } return $this; } /** * Get the count of matched elements. * * @return int Returns the count of matched elements. */ public function count() { return count($this->nodes); } /** * Format/beautify a DOM. * * @param pagelayerQuery\DomNode $dom The dom to format. * @param array $options Extra formatting options. See {@link pagelayerQuery\HtmlFormatter::$options}. * @return bool Returns `true` on sucess and `false` on failure. */ // public static function format($dom, $options = array()) { // $formatter = new pagelayerQuery\HtmlFormatter($options); // return $formatter->format($dom); // } public function getIterator() { return new ArrayIterator($this->nodes); } public function hasClass($classname) { foreach ($this->nodes as $node) { if ($node->hasClass($classname)) return true; } return false; } public function html($value = null) { if (empty($this->nodes) && $value === null) return ''; foreach ($this->nodes as $node) { if ($value === null) return $node->html(); $node->html($value); } return $this; } public function offsetExists($offset) { return isset($this->nodes[$offset]); } public function offsetGet($offset) { return isset($this->nodes[$offset]) ? $this->nodes[$offset] : null; } public function offsetSet($offset, $value) { if (is_null($offset) || !isset($this->nodes[$offset])) { throw new \BadMethodCallException("You are not allowed to add new nodes to the pQuery object."); } else { $this->nodes[$offset]->replaceWith($value); } } public function offsetUnset($offset) { if (isset($this->nodes[$offset])) { $this->nodes[$offset]->remove(); unset($this->nodes[$offset]); } } /** * Query a file or url. * * @param string $path The path to the url. * @param resource $context A context suitable to be passed into {@link file_get_contents} * @return pagelayerQuery\DomNode Returns the root dom node for the html file. */ public static function parseFile($path, $context = null) { $html_str = file_get_contents($path, false, $context); return static::parseStr($html_str); } /** * Query a string of html. * * @param string $html * @return pagelayerQuery\DomNode Returns the root dom node for the html string. */ public static function parseStr($html) { $parser = new pagelayerQuery\Html5Parser($html); return $parser->root; } public function prepend($content = null) { foreach ($this->nodes as $node) { $node->prepend($content); } return $this; } public function prop($name, $value = null) { if (empty($this->nodes) && $value === null) return ''; foreach ($this->nodes as $node) { if ($value === null) return $node->prop($name); $node->prop($name, $value); } return $this; } public function remove($selector = null) { foreach ($this->nodes as $node) { $node->remove($selector); } if ($selector === null) $this->nodes = array(); return $this; } public function removeAttr($name) { foreach ($this->nodes as $node) { $node->removeAttr($name); } return $this; } public function removeClass($classname) { foreach ($this->nodes as $node) { $node->removeClass($classname); } return $this; } public function replaceWith($content) { foreach ($this->nodes as &$node) { $node = $node->replaceWith($content); } return $this; } public function tagName($value = null) { foreach ($this->nodes as $node) { if ($value === null) return $node->tagName(); $node->tagName($value); } return $this; } public function text($value = null) { if (empty($this->nodes) && $value === null) return ''; foreach ($this->nodes as $node) { if ($value === null) return $node->text(); $node->text($value); } return $this; } public function toggleClass($classname, $switch = null) { foreach ($this->nodes as $node) { $node->toggleClass($classname, $switch); } return $this; } public function unwrap() { foreach ($this->nodes as $node) { $node->unwrap(); } return $this; } public function val($value = null) { if (empty($this->nodes) && $value === null) return ''; foreach ($this->nodes as $node) { if ($value === null) return $node->val(); $node->val($value); } return $this; } public function wrap($wrapping_element) { foreach ($this->nodes as $node) { $node->wrap($wrapping_element); } return $this; } public function wrapInner($wrapping_element) { foreach ($this->nodes as $node) { $node->wrapInner($wrapping_element); } return $this; } }