<![CDATA[ SendPing Plugin & Module - MODX Community Forums]]> https://forums.modx.com/thread/?thread=56635 <![CDATA[Re: SendPing Plugin & Module]]> https://forums.modx.com/thread/56635/sendping-plugin-module#dis-post-414526 lexwrlk Mar 03, 2012, 02:58 AM https://forums.modx.com/thread/56635/sendping-plugin-module#dis-post-414526 <![CDATA[Re: SendPing Plugin &amp; Module]]> https://forums.modx.com/thread/56635/sendping-plugin-module#dis-post-332654 althenry Feb 01, 2011, 09:22 AM https://forums.modx.com/thread/56635/sendping-plugin-module#dis-post-332654 <![CDATA[Re: SendPing Plugin &amp; Module]]> https://forums.modx.com/thread/56635/sendping-plugin-module#dis-post-332653 Quote from: Freundschaft at Jul 06, 2010, 05:14 PM

I’ve updated the modxping.inc.php file such that the designs arent screwed anymore

Thanks! Now it works smiley]]>
MichaelvanLaar Oct 10, 2010, 07:50 AM https://forums.modx.com/thread/56635/sendping-plugin-module#dis-post-332653
<![CDATA[Re: SendPing Plugin &amp; Module]]> https://forums.modx.com/thread/56635/sendping-plugin-module#dis-post-332652
Thank you for your updating. laugh]]>
zero_07 Jul 07, 2010, 09:46 AM https://forums.modx.com/thread/56635/sendping-plugin-module#dis-post-332652
<![CDATA[Re: SendPing Plugin &amp; Module]]> https://forums.modx.com/thread/56635/sendping-plugin-module#dis-post-332651
<?php
/*
 * Class: WeblogUpdate.ping Sending
 * 
 * Author: ZeRo
 * Version: 1.00
 * Date: 01/02/2007
 */

class MODxPing {
var $ping_sites;
var $ping_lang;
var $sitemap_name;
var $type;
var $plugin_mode; // 0:manual 1:automatic 2:automatic&manual

	function MODxPing($type = "module",$list=null,$sitemap=null,$plugin_mode=0)
	{
	global $modx;
		
		$this->type = strtolower($type);
		
		if(isset($GLOBALS['manager_language']) && file_exists($modx->config['base_path']."assets/modules/ping/lang/".$GLOBALS['manager_language'].".inc.php")) {
			include_once $modx->config['base_path']."assets/modules/ping/lang/".$GLOBALS['manager_language'].".inc.php";
		} 
		else {
			include_once $modx->config['base_path']."assets/modules/ping/lang/english.inc.php";
		}
		$this->ping_lang = $ping_lang;
		$chunk_data = $modx->getChunk($list);
		$chunk_data =  str_replace("\r\n","\n",$chunk_data);
		$this->ping_sites = explode("\n",$chunk_data);
		$this->sitemap_name = $sitemap;
		$this->plugin_mode = $plugin_mode;
	}
	
	//
	// view Select 
	function viewSite()
	{	$output = '';
		for ($i = 0;$i < count($this->ping_sites);$i++)
		{
			 $output .= '<input name="ping_tbl[]" type="checkbox" value="'.$i.'" checked>'.$this->ping_sites[$i]."<br />";
		}
		return $output;
	}
	
	//
	// view Select Domain(Host)
	//
	function viewDomain()
	{
	global $modx;
		$output = '';
		if (isset($modx->config['subdomains']))
		{
			$output .= '<div class="sectionHeader"> '.$this->ping_lang['select_domain'].'</div>';
			$output .= '<div class="sectionBody">';
			$output .= '<select name="domain">';
			$host_array = array($modx->config['site_url']);
			$domains = $modx->config['subdomains'];
			foreach ($domains as $domain => $value)
			{
				if (!strstr($domain,"http://"))
				{ 	$domain = "http://".$domain."/";
				}
			   array_push($host_array,$domain);
			}

			foreach ($host_array as $host) {
			    $output .= "<option value=\"{$host}\">{$host}</option>\n";
			}
			$output .= "</select></div>";
		} else
		{
			$output .= '<input type="hidden" name="domain" value="'.$modx->config['site_url'].'">';
		}
		return $output;
	}
	
	//
	// View Form
	//
	function viewForm()
	{
		
		switch ($this->type)
		{
		case "module":
			$default_sitemap = $this->sitemap_name != '' ? 'checked':' disabled';
			$output = '
			<h1>'.$this->ping_lang['title'].'</h1>

<div id="actions">
		<ul class="actionButtons">
    		  <li id="Button4">
    			<a href="#" onclick="document.location.href=\'index.php?a=106\';">
    			  <img src="media/style/MODxCarbon/images/icons/stop.png" />Cancel</a>
    		  </li>
		</ul>
</div>

			<script language="JavaScript" type="text/javascript">
			function postForm(opcode){
			document.module.opcode.value=opcode;
			document.module.submit();
			}
			</script>
			<form name="module" method="post">
			<input name="opcode" type="hidden" value="" />
			'.$this->viewDomain().'
			<div class="sectionHeader"> '.$this->ping_lang['select_host'].'</div>
			<div class="sectionBody">
			'.$this->viewSite().'
			</div>
			<div class="sectionHeader"> '.$this->ping_lang['sitemap_title'].'</div>
			<div class="sectionBody">
			<input type="checkbox" name="google_sitemap" '.$default_sitemap.' />'.$this->ping_lang['sitemap_send'].'</div>
			<input type="submit" style="margin-left:5em;" name="submit" onclick="postForm(\'send\');" value="'.$this->ping_lang['submit'].'" />
			</form>';
			break;
		case "plugin":
			if (!$this->plugin_mode)
			{	$default_exec = $this->plugin_mode == 0 ? 'checked':'';
				$default_sitemap = $this->sitemap_name != '' ? 'checked':' disabled';
				$output =
				'
<div class="sectionHeader"> '.$this->ping_lang['title'].'</div>
					<div class="sectionBody">
					<input type="checkbox" name="ping_go" '.$default_exec.' />'.$this->ping_lang['execute'].$this->viewDomain()
					.'<div class="sectionHeader"> '
					.$this->ping_lang['select_host'].'</div>
					<div class="sectionBody">'.$this->viewSite().'</div>
					<div class="sectionHeader"> '
					.$this->ping_lang['sitemap_title'].'</div>
					<div class="sectionBody">
					<input type="checkbox" name="google_sitemap" '.$default_sitemap.' />'.$this->ping_lang['sitemap_send'].'
					</div>
				</div>';
			}
			break;
		}
		return $output;
	}
	function Send()
	{
	global $modx;
	
		require_once($modx->config['base_path']."assets/modules/ping/lib/xmlrpc.inc");
		$output = '
			<h1>'.$this->ping_lang['title'].'</h1>

<div id="actions">
		<ul class="actionButtons">
    		  <li id="Button4">
    			<a href="#" onclick="document.location.href=\'index.php?a=106\';">
    			  <img src="media/style/MODxCarbon/images/icons/save.png" />OK</a>
    		  </li>
		</ul>
</div>

	<div class="sectionHeader">'.$this->ping_lang['result_title'].'</div>';
		
		$site_url = isset($_POST['domain']) ? $_POST['domain']:$modx->config['site_url'];
		if ($site_url != $modx->config['site_url'])
		{	$domainreq = substr($site_url,7,-1);
			$start_id = $modx->config['subdomains'][$domainreq]['startid'];
			$start_doc = $modx->getDocument($start_id);
			$site_title = $modx->config['site_name']." ".$start_doc['longtitle'];

		}else
		{      $site_title = $modx->config['site_name'];
		}
		if ($this->ping_lang['encode'] != "")
		{
			if ($modx->config['modx_charset'] != $this->ping_lang['encode'])
			{
				$site_name = mb_convert_encoding($site_title,$this->ping_lang['encode'],$modx->config['modx_charset']);
			} else
			{	$site_name = $site_title;
			}
			$GLOBALS['xmlrpc_internalencoding']=$this->ping_lang['encode'];
		}
		$name_param = new xmlrpcval($site_name, 'string');
		$url_param = new xmlrpcval($site_url.'feed.rss', 'string');
		$params = array($name_param, $url_param);

		if (isset($_POST['ping_tbl']) || ($this->type == "plugin" && $this->plugin_mode == 1))
		{
			if (isset($_POST['ping_tbl']))
			{
				$ping_tbl = $_POST['ping_tbl'];
			} else
			{
				for ($i = 0;$i < count($this->ping_sites);$i++)
				{	$ping_tbl[] = $i;
				}
			}
			$output .= '<div class="sectionBody"><ul>';
			foreach ($ping_tbl as $idx)
			{
				$ping_url  = $this->ping_sites[$idx];
				$output .=  "<li>".$ping_url.":" ;
				$target_path = parse_url($ping_url);
				$message = new xmlrpcmsg("weblogUpdates.ping", $params);
				$client = new xmlrpc_client($target_path['path'], $target_path['host'], 80);
				if ($this->ping_lang["encode"] != "") $client->request_charset_encoding = $this->ping_lang["encode"];
				$response =  $client->send($message);
				if ($response == 0) {
				    $output .= "  Error pinging " . $client->errno . " " . $client->errstring;
				    continue;
				}
				if ($response->faultCode() != 0)  {
				    $output .="  Error pinging " . $response->faultCode() . " " . $response->faultString();
				    continue;
				}
				$response_value = $response->value();
			    if ($response_value->scalartyp() != $GLOBALS['xmlrpcInt'])
				{	$fl_error = $response_value->structmem('flerror');
					$message = $response_value->structmem('message');
					// read the response
					 $output .= $response->value()->serialize();
				} else
				{	$output .= "  Unkown type (Success?)";
				}
			}
			$output .= "</ul></div>";
		}
		if ($this->sitemap_name != '' && (isset($_POST['google_sitemap']) || ($this->type == "plugin" && $this->plugin_mode == 1)))
		{
			$sitemap_url = $site_url.$this->sitemap_name;
			$output.= '<div class="sectionHeader">'.$this->ping_lang['sitemap_title'].'</div>';
			$output .= '<div class="sectionBody">'.$sitemap_url.'</div>';
			$google_ping = "http://www.google.com/webmasters/sitemaps/ping?sitemap=".urlencode($sitemap_url);
			@file_get_contents($google_ping);
		}
		return $output;
	}
}
?>
]]>
Freundschaft Jul 06, 2010, 12:14 PM https://forums.modx.com/thread/56635/sendping-plugin-module#dis-post-332651
<![CDATA[Re: SendPing Plugin &amp; Module]]> https://forums.modx.com/thread/56635/sendping-plugin-module#dis-post-332650
But there is still one error message left:

Fatal error: Call to a member function scalarval() on a non-object in /[...path on my server...]/assets/modules/ping/modxping.inc.php on line 204


Any idea how to fix this?]]>
MichaelvanLaar Apr 04, 2010, 09:28 AM https://forums.modx.com/thread/56635/sendping-plugin-module#dis-post-332650
<![CDATA[SendPing Plugin &amp; Module]]> https://forums.modx.com/thread/56635/sendping-plugin-module#dis-post-332649 修正は、1.04cのミスと若干の記述の変更です。
機能的なアップはありません。

]]>
zero_07 Feb 10, 2007, 01:01 AM https://forums.modx.com/thread/56635/sendping-plugin-module#dis-post-332649